From e3aadc562f2ecd2ab997e10e3e599b8774a099a5 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Thu, 2 Jan 2014 11:05:15 -0500 Subject: [PATCH] Rscons::Varset: remove unused type parameter to #[] --- lib/rscons/varset.rb | 16 ++-------------- spec/rscons/varset_spec.rb | 6 ------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/lib/rscons/varset.rb b/lib/rscons/varset.rb index 7eddfbd..80dee59 100644 --- a/lib/rscons/varset.rb +++ b/lib/rscons/varset.rb @@ -17,20 +17,8 @@ module Rscons # Access the value of variable as a particular type # @param key [String, Symbol] The variable name. - # @param type [Symbol, nil] Optional specification of the type desired. - # If the variable is a String and type is :array, a 1-element array with - # the variable value will be returned. If the variable is an Array and - # type is :string, the first element from the variable value will be - # returned. - def [](key, type = nil) - val = @vars[key] - if type == :array and not val.is_a?(Array) - [val] - elsif type == :scalar and val.is_a?(Array) - val.first - else - val - end + def [](key) + @vars[key] end # Assign a value to a variable. diff --git a/spec/rscons/varset_spec.rb b/spec/rscons/varset_spec.rb index e52b7d9..415dfee 100644 --- a/spec/rscons/varset_spec.rb +++ b/spec/rscons/varset_spec.rb @@ -30,12 +30,6 @@ module Rscons v["qax"].should == [3, 6] v["qux"].should == {a: :b} end - it "allows accessing a non-array converted to an array" do - v["fuz", :array].should == ["a string"] - end - it "allows accessing an array as a single value" do - v["qax", :scalar].should == 3 - end end describe :[]= do