Class: Pokotarou::RegistrationConfigUpdater::OptionConfig

Inherits:
Object
  • Object
show all
Extended by:
ArrayUtils
Defined in:
lib/pokotarou/registration_config_updater/option_config.rb

Class Method Summary collapse

Methods included from ArrayUtils

get_rotated_val

Class Method Details

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



18
19
20
21
22
# File 'lib/pokotarou/registration_config_updater/option_config.rb', line 18

def execute arr, size, option_conf, cnt = 0
  selected_val = select(option_conf[:select], arr, size, cnt)
  
  add(option_conf[:add], selected_val, cnt)
end

.fetch(option_hash, key) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/pokotarou/registration_config_updater/option_config.rb', line 9

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