Class: Burner::Modeling::KeyIndexMapping

Inherits:
Object
  • Object
show all
Defined in:
lib/burner/modeling/key_index_mapping.rb

Overview

Generic relationship between a numeric index and a key.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index:, key:) ⇒ KeyIndexMapping

Returns a new instance of KeyIndexMapping.

Raises:

  • (ArgumentError)


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

#indexObject (readonly)

Returns the value of attribute index.



16
17
18
# File 'lib/burner/modeling/key_index_mapping.rb', line 16

def index
  @index
end

#keyObject (readonly)

Returns the value of attribute key.



16
17
18
# File 'lib/burner/modeling/key_index_mapping.rb', line 16

def key
  @key
end