anima
anima copied to clipboard
Anima breaks on `#with` and `#to_h` if an attribute is private or protected
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)
@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.