Class: DynamicCard

Inherits:
Object
  • Object
show all
Defined in:
lib/bank_api/values/dynamic_card.rb

Instance Method Summary collapse

Constructor Details

#initialize(entries) ⇒ DynamicCard

Returns a new instance of DynamicCard.



4
5
6
# File 'lib/bank_api/values/dynamic_card.rb', line 4

def initialize(entries)
  @coordinates_array = YAML::safe_load(entries.gsub(/,\s*([^\s])/, ', \1'))
end

Instance Method Details

#get_coordinate_value(coordinate) ⇒ Object



8
9
10
11
12
# File 'lib/bank_api/values/dynamic_card.rb', line 8

def get_coordinate_value(coordinate)
  col = ('A'..'J').to_a.index(coordinate[0])
  row = (1..5).to_a.index(coordinate[1].to_i)
  @coordinates_array[row][col]
end