Class: AtlasEngine::AddressValidation::Candidate::Component
- Inherits:
-
Object
- Object
- AtlasEngine::AddressValidation::Candidate::Component
- Extended by:
- T::Sig
- Defined in:
- app/models/atlas_engine/address_validation/candidate.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
- #sequences ⇒ Object
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #first_value ⇒ Object
-
#initialize(name, value) ⇒ Component
constructor
A new instance of Component.
- #serialize ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(name, value) ⇒ Component
Returns a new instance of Component.
80 81 82 83 |
# File 'app/models/atlas_engine/address_validation/candidate.rb', line 80 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
70 71 72 |
# File 'app/models/atlas_engine/address_validation/candidate.rb', line 70 def name @name end |
#sequences ⇒ Object
90 91 92 |
# File 'app/models/atlas_engine/address_validation/candidate.rb', line 90 def sequences @sequences ||= values.map { |val| AtlasEngine::AddressValidation::Token::Sequence.from_string(val) } end |
#value ⇒ Object
Returns the value of attribute value.
72 73 74 |
# File 'app/models/atlas_engine/address_validation/candidate.rb', line 72 def value @value end |
Instance Method Details
#first_value ⇒ Object
85 86 87 |
# File 'app/models/atlas_engine/address_validation/candidate.rb', line 85 def first_value values.first end |
#serialize ⇒ Object
95 96 97 98 99 100 101 |
# File 'app/models/atlas_engine/address_validation/candidate.rb', line 95 def serialize if value.is_a?(Array) "[#{value.map(&:to_s).join(",")}]" else value.to_s end end |
#values ⇒ Object
104 105 106 |
# File 'app/models/atlas_engine/address_validation/candidate.rb', line 104 def values Array(value) end |