Method: Command::Setting#casting_variable
- Defined in:
- lib/command/setting.rb
#casting_variable(name, value) ⇒ Object
値の文字列を設定に基づいた型にキャストして、[scope, value] 形式で返す不正な設定名もしくは値の場合は例外を吐く
69 70 71 72 73 74 75 76 |
# File 'lib/command/setting.rb', line 69 def casting_variable(name, value) scope = get_scope_of_variable_name(name) unless scope raise Helper::InvalidVariableName, "#{name} は不明な名前です" end casted_value = Helper.string_cast_to_type(value, SETTING_VARIABLES[scope][name][0]) [scope, casted_value] end |