Class: Foobara::AttributesTransformers::Set
- Inherits:
-
AttributesTransformers
- Object
- AttributesTransformers
- Foobara::AttributesTransformers::Set
- Defined in:
- foobara-0.6.1/projects/typesystem/projects/type_declarations/src/attributes_transformers/set.rb
Class Attribute Summary collapse
-
.attribute_names_to_values ⇒ Object
Returns the value of attribute attribute_names_to_values.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.attribute_names_to_values ⇒ Object
Returns the value of attribute attribute_names_to_values.
33 34 35 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/set.rb', line 33 def attribute_names_to_values @attribute_names_to_values end |
Class Method Details
.symbol ⇒ Object
35 36 37 38 39 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/set.rb', line 35 def symbol if attribute_names_to_values symbol_for_attribute_names(attribute_names_to_values.keys) end end |
.will_set_scoped_path? ⇒ Boolean
41 42 43 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/set.rb', line 41 def will_set_scoped_path? true end |
Instance Method Details
#from_type_declaration ⇒ Object
56 57 58 59 60 61 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/set.rb', line 56 def from_type_declaration if to_type to_declaration = to_type.declaration_data TypeDeclarations::Attributes.reject(to_declaration, *self.class.attribute_names_to_values.keys) end end |
#to_type_declaration ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/set.rb', line 46 def to_type_declaration # TODO: test this # simplecov:disable if from_type from_declaration = from_type.declaration_data TypeDeclarations::Attributes.reject(from_declaration, *self.class.attribute_names_to_values.keys) end # simplecov:enable end |
#transform(inputs) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/set.rb', line 63 def transform(inputs) to_merge = {} self.class.attribute_names_to_values.each_pair do |input_name, value| if value.is_a?(::Proc) value = value.call end to_merge[input_name] = value end inputs.merge(to_merge) end |