dry-view: ArgumentError: wrong number of arguments (given 3, expected 1..2)

Describe the bug

When I try to load the following code:

require "dry/view"

class ArticleView < Dry::View
  config.paths = [File.join(__dir__, "templates")]
  config.layout = "application"
  config.template = "articles/show"

  attr_reader :article_repo

  def initialize(article_repo:)
    @article_repo = article_repo
  end

  expose :article do |slug:|
    article_repo.by_slug(slug)
  end
end

I receive the following error:

ArgumentError: wrong number of arguments (given 3, expected 1..2)
from /Users/mateuszurbanski/.gem/ruby/3.0.0/gems/dry-view-0.7.0/lib/dry/view/exposures.rb:32:in `add'

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Thanks for the bump, I’ll get onto this today.

I’d certainly appreciate a patch release of dry-view

I submitted a PR to make specs green on dry-view, and requested a minor or patch to be released with the Ruby 3 fixes.

When I switched to Ruby 2.7.2 everything is working fine so it seems that this is Ruby 3.0 issue.