Browse Source

Layouts use strings as keys, so that must be realistic

dev
Andy Meneely 11 years ago
parent
commit
b5903293d7
  1. 2
      lib/squib/args/arg_loader.rb
  2. 4
      spec/args/box_spec.rb

2
lib/squib/args/arg_loader.rb

@ -65,7 +65,7 @@ module Squib
val = instance_variable_get(attribute) val = instance_variable_get(attribute)
if val.respond_to? :each if val.respond_to? :each
new_val = val.map.with_index do |v, i| new_val = val.map.with_index do |v, i|
v ||= layout[layout_args[i].to_s][param] unless layout_args[i].nil? v ||= layout[layout_args[i].to_s][param.to_s] unless layout_args[i].nil?
v ||= default v ||= default
end end
instance_variable_set(attribute, new_val) instance_variable_set(attribute, new_val)

4
spec/args/box_spec.rb

@ -49,8 +49,8 @@ describe Squib::Args::Box do
context 'layouts' do context 'layouts' do
let(:layout) do let(:layout) do
{ 'attack' => { x: 50 }, { 'attack' => { 'x' => 50 },
'defend' => { x: 60 } } 'defend' => { 'x' => 60 } }
end end
it 'are used when not specified' do it 'are used when not specified' do

Loading…
Cancel
Save