Class: Addressing::FieldOverrides
- Inherits:
-
Object
- Object
- Addressing::FieldOverrides
- Defined in:
- lib/addressing/field_override.rb
Instance Attribute Summary collapse
-
#hidden_fields ⇒ Object
readonly
Returns the value of attribute hidden_fields.
-
#optional_fields ⇒ Object
readonly
Returns the value of attribute optional_fields.
-
#required_fields ⇒ Object
readonly
Returns the value of attribute required_fields.
Instance Method Summary collapse
-
#initialize(definition) ⇒ FieldOverrides
constructor
A new instance of FieldOverrides.
Constructor Details
#initialize(definition) ⇒ FieldOverrides
Returns a new instance of FieldOverrides.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/addressing/field_override.rb', line 13 def initialize(definition) AddressField.assert_all_exist(definition.keys) FieldOverride.assert_all_exist(definition.values) @hidden_fields = [] @optional_fields = [] @required_fields = [] definition.each do |field, override| case override when FieldOverride::HIDDEN @hidden_fields << field when FieldOverride::OPTIONAL @optional_fields << field when FieldOverride::REQUIRED @required_fields << field end end end |
Instance Attribute Details
#hidden_fields ⇒ Object (readonly)
Returns the value of attribute hidden_fields.
11 12 13 |
# File 'lib/addressing/field_override.rb', line 11 def hidden_fields @hidden_fields end |
#optional_fields ⇒ Object (readonly)
Returns the value of attribute optional_fields.
11 12 13 |
# File 'lib/addressing/field_override.rb', line 11 def optional_fields @optional_fields end |
#required_fields ⇒ Object (readonly)
Returns the value of attribute required_fields.
11 12 13 |
# File 'lib/addressing/field_override.rb', line 11 def required_fields @required_fields end |