Class: Blueprinter::Field Private
- Inherits:
-
Object
- Object
- Blueprinter::Field
- Defined in:
- lib/blueprinter/field.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
Instance Attribute Summary collapse
- #blueprint ⇒ Object readonly private
- #extractor ⇒ Object readonly private
- #method ⇒ Object readonly private
- #name ⇒ Object readonly private
- #options ⇒ Object readonly private
Instance Method Summary collapse
- #extract(object, local_options) ⇒ Object private
-
#initialize(method, name, extractor, blueprint, options = {}) ⇒ Field
constructor
private
A new instance of Field.
- #skip?(field_name, object, local_options) ⇒ Boolean private
Constructor Details
#initialize(method, name, extractor, blueprint, options = {}) ⇒ Field
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Field.
8 9 10 11 12 13 14 |
# File 'lib/blueprinter/field.rb', line 8 def initialize(method, name, extractor, blueprint, = {}) @method = method @name = name @extractor = extractor @blueprint = blueprint @options = end |
Instance Attribute Details
#blueprint ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/blueprinter/field.rb', line 6 def blueprint @blueprint end |
#extractor ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/blueprinter/field.rb', line 6 def extractor @extractor end |
#method ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/blueprinter/field.rb', line 6 def method @method end |
#name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/blueprinter/field.rb', line 6 def name @name end |
#options ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/blueprinter/field.rb', line 6 def @options end |
Instance Method Details
#extract(object, local_options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/blueprinter/field.rb', line 16 def extract(object, ) extractor.extract(method, object, , ) end |
#skip?(field_name, object, local_options) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 24 |
# File 'lib/blueprinter/field.rb', line 20 def skip?(field_name, object, ) return true if if_callable && !if_callable.call(field_name, object, ) unless_callable && unless_callable.call(field_name, object, ) end |