Module: OpenapiBlocks::Concerns::Schemable::ClassMethods
- Defined in:
- lib/openapi_blocks/concerns/schemable.rb
Overview
rubocop:disable Style/Documentation
Instance Attribute Summary collapse
-
#_associations ⇒ Object
readonly
Returns the value of attribute _associations.
-
#_ignored ⇒ Object
readonly
Returns the value of attribute _ignored.
-
#_model ⇒ Object
readonly
Returns the value of attribute _model.
-
#_serializes ⇒ Object
readonly
Returns the value of attribute _serializes.
-
#_virtual_attributes ⇒ Object
readonly
Returns the value of attribute _virtual_attributes.
Instance Method Summary collapse
- #association(name, type: nil, read_only: false) ⇒ Object
- #attribute(name) ⇒ Object
- #ignore(*attributes) ⇒ Object
- #model(klass = nil) ⇒ Object
- #serializes(*models) ⇒ Object
Instance Attribute Details
#_associations ⇒ Object (readonly)
Returns the value of attribute _associations.
11 12 13 |
# File 'lib/openapi_blocks/concerns/schemable.rb', line 11 def _associations @_associations end |
#_ignored ⇒ Object (readonly)
Returns the value of attribute _ignored.
11 12 13 |
# File 'lib/openapi_blocks/concerns/schemable.rb', line 11 def _ignored @_ignored end |
#_model ⇒ Object (readonly)
Returns the value of attribute _model.
11 12 13 |
# File 'lib/openapi_blocks/concerns/schemable.rb', line 11 def _model @_model end |
#_serializes ⇒ Object (readonly)
Returns the value of attribute _serializes.
11 12 13 |
# File 'lib/openapi_blocks/concerns/schemable.rb', line 11 def _serializes @_serializes end |
#_virtual_attributes ⇒ Object (readonly)
Returns the value of attribute _virtual_attributes.
11 12 13 |
# File 'lib/openapi_blocks/concerns/schemable.rb', line 11 def _virtual_attributes @_virtual_attributes end |
Instance Method Details
#association(name, type: nil, read_only: false) ⇒ Object
22 23 24 25 |
# File 'lib/openapi_blocks/concerns/schemable.rb', line 22 def association(name, type: nil, read_only: false) @_associations ||= [] @_associations << { name: name, type: type, read_only: read_only } end |
#attribute(name) ⇒ Object
27 28 29 30 |
# File 'lib/openapi_blocks/concerns/schemable.rb', line 27 def attribute(name, **) @_virtual_attributes ||= [] @_virtual_attributes << { name: name, ** } end |
#ignore(*attributes) ⇒ Object
17 18 19 20 |
# File 'lib/openapi_blocks/concerns/schemable.rb', line 17 def ignore(*attributes) @_ignored ||= [] @_ignored.concat(attributes.map(&:to_s)) end |
#model(klass = nil) ⇒ Object
13 14 15 |
# File 'lib/openapi_blocks/concerns/schemable.rb', line 13 def model(klass = nil) klass ? @_model = klass : @_model ||= infer_model # rubocop:disable Naming/MemoizedInstanceVariableName end |
#serializes(*models) ⇒ Object
32 33 34 35 |
# File 'lib/openapi_blocks/concerns/schemable.rb', line 32 def serializes(*models) @_serializes ||= [] @_serializes.concat(models) end |