Class: Granite::Action::Types::Collection
- Inherits:
-
Object
- Object
- Granite::Action::Types::Collection
- Defined in:
- lib/granite/action/types/collection.rb
Instance Attribute Summary collapse
-
#subtype_definition ⇒ Object
readonly
Returns the value of attribute subtype_definition.
Instance Method Summary collapse
- #ensure_type(value) ⇒ Object
-
#initialize(subtype_definition) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(subtype_definition) ⇒ Collection
Returns a new instance of Collection.
7 8 9 |
# File 'lib/granite/action/types/collection.rb', line 7 def initialize(subtype_definition) @subtype_definition = subtype_definition end |
Instance Attribute Details
#subtype_definition ⇒ Object (readonly)
Returns the value of attribute subtype_definition.
5 6 7 |
# File 'lib/granite/action/types/collection.rb', line 5 def subtype_definition @subtype_definition end |
Instance Method Details
#ensure_type(value) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/granite/action/types/collection.rb', line 11 def ensure_type(value) if value.respond_to? :transform_values value.transform_values { |v| subtype_definition.ensure_type(v) } elsif value.respond_to?(:map) value.map { |v| subtype_definition.ensure_type(v) } end end |