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
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/jsonapi_compliable/extensions/extra_attribute.rb', line 11 def extra_attribute(name, = {}, &blk) allow_field = proc { if [:if] next false unless instance_eval(&[:if]) end if @extra_fields && @extra_fields[jsonapi_type] @extra_fields[jsonapi_type].include?(name) else false end } attribute name, if: allow_field, &blk end |