Module: Graphiti::Extensions::BooleanAttribute::ClassMethods
- Defined in:
- lib/graphiti/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/graphiti/extensions/boolean_attribute.rb', line 21 def boolean_attribute(name, = {}, &blk) blk ||= proc { @object.public_send(name) } field_name = :"is_#{name.to_s.delete("?")}" attribute field_name, , &blk end |