Class: Burner::Modeling::KeyIndexMapping
- Inherits:
-
Object
- Object
- Burner::Modeling::KeyIndexMapping
- Defined in:
- lib/burner/modeling/key_index_mapping.rb
Overview
Generic relationship between a numeric index and a key.
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#initialize(index:, key:) ⇒ KeyIndexMapping
constructor
A new instance of KeyIndexMapping.
Constructor Details
#initialize(index:, key:) ⇒ KeyIndexMapping
Returns a new instance of KeyIndexMapping.
18 19 20 21 22 23 24 25 26 |
# File 'lib/burner/modeling/key_index_mapping.rb', line 18 def initialize(index:, key:) raise ArgumentError, 'index is required' if index.to_s.empty? raise ArgumentError, 'key is required' if key.to_s.empty? @index = index.to_i @key = key.to_s freeze end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
16 17 18 |
# File 'lib/burner/modeling/key_index_mapping.rb', line 16 def index @index end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
16 17 18 |
# File 'lib/burner/modeling/key_index_mapping.rb', line 16 def key @key end |