t6d / smart_properties

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

Enable `accepts: Boolean` syntax #46

Closed SebastianSzturo closed 7 years ago

SebastianSzturo commented 8 years ago

Currently we need to write following code to get validation for a boolean value for a property:

property :title, accepts: String
property :price, accepts: Integer
property :new, accepts: [true, false]

By injecting a constant Boolean with the values [true, false] we can enable following syntax:

property :title, accepts: String
property :price, accepts: Integer
property :new, accepts: Boolean