Class: Foobara::AttributesTransformers::Only
- Inherits:
-
AttributesTransformers
- Object
- AttributesTransformers
- Foobara::AttributesTransformers::Only
- Defined in:
- foobara-0.6.1/projects/typesystem/projects/type_declarations/src/attributes_transformers/only.rb
Class Attribute Summary collapse
-
.only_attributes ⇒ Object
Returns the value of attribute only_attributes.
Class Method Summary collapse
Instance Method Summary collapse
- #allowed_keys ⇒ Object
- #from_type_declaration ⇒ Object
- #to_type_declaration ⇒ Object
- #transform(inputs) ⇒ Object
Class Attribute Details
.only_attributes ⇒ Object
Returns the value of attribute only_attributes.
30 31 32 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/only.rb', line 30 def only_attributes @only_attributes end |
Class Method Details
.symbol ⇒ Object
32 33 34 35 36 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/only.rb', line 32 def symbol if only_attributes symbol_for_attribute_names(only_attributes) end end |
.will_set_scoped_path? ⇒ Boolean
38 39 40 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/only.rb', line 38 def will_set_scoped_path? true end |
Instance Method Details
#allowed_keys ⇒ Object
62 63 64 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/only.rb', line 62 def allowed_keys to_type.element_types.keys end |
#from_type_declaration ⇒ Object
50 51 52 53 54 55 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/only.rb', line 50 def from_type_declaration if to_type to_declaration = to_type.declaration_data TypeDeclarations::Attributes.only(to_declaration, *self.class.only_attributes) end end |
#to_type_declaration ⇒ Object
43 44 45 46 47 48 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/only.rb', line 43 def to_type_declaration if from_type from_declaration = from_type.declaration_data TypeDeclarations::Attributes.only(from_declaration, *self.class.only_attributes) end end |
#transform(inputs) ⇒ Object
57 58 59 60 |
# File 'projects/typesystem/projects/type_declarations/src/attributes_transformers/only.rb', line 57 def transform(inputs) inputs = Util.symbolize_keys(inputs) inputs.slice(*allowed_keys) end |