Class: PluckMap::StructuredAttribute
- Defined in:
- lib/pluck_map/structured_attribute.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Attributes inherited from Attribute
#block, #id, #indexes, #model, #name, #selects, #value
Instance Method Summary collapse
-
#initialize(attribute_name, model, block, options = {}) ⇒ StructuredAttribute
constructor
A new instance of StructuredAttribute.
- #nested? ⇒ Boolean
- #will_map? ⇒ Boolean
Methods inherited from Attribute
#==, #apply, #eql?, #exec, #hash, #preload!, #to_ruby, #value?, #values
Constructor Details
#initialize(attribute_name, model, block, options = {}) ⇒ StructuredAttribute
Returns a new instance of StructuredAttribute.
7 8 9 10 11 |
# File 'lib/pluck_map/structured_attribute.rb', line 7 def initialize(attribute_name, model, block, ={}) @attributes = AttributeBuilder.build(model: model, &block) = .slice(:as).merge(select: build_select, map: build_map) super(attribute_name, model, ) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/pluck_map/structured_attribute.rb', line 5 def attributes @attributes end |
Instance Method Details
#nested? ⇒ Boolean
17 18 19 |
# File 'lib/pluck_map/structured_attribute.rb', line 17 def nested? true end |
#will_map? ⇒ Boolean
13 14 15 |
# File 'lib/pluck_map/structured_attribute.rb', line 13 def will_map? attributes.any?(&:will_map?) end |