Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anima breaks on #with and #to_h if an attribute is private or protected #26

Open
backus opened this issue Jul 19, 2016 · 1 comment
Open

Comments

@backus
Copy link

backus commented Jul 19, 2016

require 'anima'

Anima::VERSION # => "0.4.2"

class Dog
  include Anima.new(:name, :age, :breed)

  private :breed
end

spot = Dog.new(name: 'Spot', age: 5, breed: 'Dalmatian')
spot                # => #<Dog name="Spot" age=5 breed="Dalmatian">
spot.with(age: 6)   # => private method `breed' called for #<Dog name="Spot" age=5 breed="Dalmatian"> (NoMethodError)
spot.to_h           # => private method `breed' called for #<Dog name="Spot" age=5 breed="Dalmatian"> (NoMethodError)
@backus
Copy link
Author

backus commented Jul 19, 2016

@mbj I would be happy to PR a fix for this if you would agree this should be fixed. I realize you eventually want protected by default like in #24 but I would consider fixing this an incremental improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant