t6d / smart_properties

Ruby accessors on steroids
MIT License
177 stars 20 forks source link

Add support for custom reader #45

Closed SebastianSzturo closed 8 years ago

SebastianSzturo commented 8 years ago

Allows you to define a custom reader name for your property.

class Post
  property :new, default: false, accepts: [true, false], reader: :new?
end

post = Post.new(new: false)
post.new? # false

post[:new] = true
post.new? # true
post[:new] # true
t6d commented 8 years ago

Thanks a lot! 👍