Class: RSchema::Coercers::FixedHash::RemoveExtraneousAttributes
- Inherits:
-
Object
- Object
- RSchema::Coercers::FixedHash::RemoveExtraneousAttributes
- Defined in:
- lib/rschema/coercers/fixed_hash/remove_extraneous_attributes.rb
Instance Attribute Summary collapse
-
#hash_attributes ⇒ Object
readonly
Returns the value of attribute hash_attributes.
Class Method Summary collapse
Instance Method Summary collapse
- #call(value) ⇒ Object
-
#initialize(fixed_hash_schema) ⇒ RemoveExtraneousAttributes
constructor
A new instance of RemoveExtraneousAttributes.
Constructor Details
#initialize(fixed_hash_schema) ⇒ RemoveExtraneousAttributes
Returns a new instance of RemoveExtraneousAttributes.
12 13 14 15 |
# File 'lib/rschema/coercers/fixed_hash/remove_extraneous_attributes.rb', line 12 def initialize(fixed_hash_schema) #TODO: make fixed hash attributes frozen, and eliminate dup @hash_attributes = fixed_hash_schema.attributes.map(&:dup) end |
Instance Attribute Details
#hash_attributes ⇒ Object (readonly)
Returns the value of attribute hash_attributes.
6 7 8 |
# File 'lib/rschema/coercers/fixed_hash/remove_extraneous_attributes.rb', line 6 def hash_attributes @hash_attributes end |
Class Method Details
.build(schema) ⇒ Object
8 9 10 |
# File 'lib/rschema/coercers/fixed_hash/remove_extraneous_attributes.rb', line 8 def self.build(schema) new(schema) end |
Instance Method Details
#call(value) ⇒ Object
17 18 19 |
# File 'lib/rschema/coercers/fixed_hash/remove_extraneous_attributes.rb', line 17 def call(value) Result.success(remove_extraneous_elements(value)) end |