Class: Option

Inherits:
Object
  • Object
show all
Defined in:
lib/pokotarou/option.rb

Class Method Summary collapse

Class Method Details

.apply(arr, size, option_conf, cnt = 0) ⇒ Object



10
11
12
13
14
# File 'lib/pokotarou/option.rb', line 10

def apply arr, size, option_conf, cnt = 0
  selected_val = select(option_conf[:select], arr, size, cnt)

  add(option_conf[:add], selected_val, cnt)
end

.gen(option) ⇒ Object



3
4
5
6
7
8
# File 'lib/pokotarou/option.rb', line 3

def gen option
  # shape option data
  # [option1, option2] => { select: [option2], add: [option1] }
  # [] => { select: [], add: [] }
  option.nil? ? { select: [], add: [] } : separate(option)
end