Module: JsonapiCompliable::Extensions::ExtraAttribute::ClassMethods
- Defined in:
- lib/jsonapi_compliable/extensions/extra_attribute.rb
Instance Method Summary collapse
Instance Method Details
#extra_attribute(name, options = {}, &blk) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/jsonapi_compliable/extensions/extra_attribute.rb', line 43 def extra_attribute(name, = {}, &blk) allow_field = proc { if [:if] next false unless instance_eval(&[:if]) end @extra_fields[@_type] && @extra_fields[@_type].include?(name) } attribute name, if: allow_field, &blk end |