Module: JsonapiCompliable::Extensions::BooleanAttribute::ClassMethods
- Defined in:
- lib/jsonapi_compliable/extensions/boolean_attribute.rb
Instance Method Summary collapse
-
#boolean_attribute(name, options = {}, &blk) ⇒ Object
Register a boolean attribute.
Instance Method Details
#boolean_attribute(name, options = {}, &blk) ⇒ Object
Register a boolean attribute
21 22 23 24 25 |
# File 'lib/jsonapi_compliable/extensions/boolean_attribute.rb', line 21 def boolean_attribute(name, = {}, &blk) blk ||= proc { @object.public_send(name) } field_name = :is_#{name.to_s.gsub('?', '')}" attribute field_name, , &blk end |