lib/mothership/inputs.rb in mothership-0.0.9 vs lib/mothership/inputs.rb in mothership-0.0.10

- old
+ new

@@ -8,21 +8,25 @@ @given = given @inputs = inputs end def given?(name) - @given.key?(name) + @inputs.key?(name) || @given.key?(name) end def given(name) - @given[name] + @inputs[name] || @given[name] end def merge(inputs) self.class.new(@command, @context, @given, @inputs.merge(inputs)) end + def merge_given(inputs) + self.class.new(@command, @context, @given.merge(inputs), @inputs) + end + def without(*names) given = @given.dup inputs = @inputs.dup names.each do |n| given.delete(n) @@ -44,9 +48,10 @@ singular = meta[:singular] return @inputs[name] = [@inputs[singular]] if @inputs.key?(singular) given = @given[name] if @given.key?(name) + given ||= [@given[singular]] if @given.key?(singular) # value given; convert if needed if given && given != [] return @inputs[name] = convert_given(meta, context, given, *args) end