From 3b8910075a7515aac7ffe2a7ad6c2be88ad6de93 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sun, 15 Feb 2015 18:38:09 -0500 Subject: [PATCH] use class instance variables instead of class variables --- lib/rscons.rb | 6 +++--- spec/rscons_spec.rb | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/rscons.rb b/lib/rscons.rb index cedbb18..a7e8f08 100644 --- a/lib/rscons.rb +++ b/lib/rscons.rb @@ -91,7 +91,7 @@ module Rscons # # @return [Array] The shell and flag. def get_system_shell - @@shell ||= + @shell ||= begin test_shell = lambda do |*args| begin @@ -124,7 +124,7 @@ module Rscons # # @return [Array] Command used to execute commands. def command_executer - @@command_executer ||= + @command_executer ||= if Object.const_get("RUBY_PLATFORM") =~ /mingw/ if ENV.keys.find {|key| key =~ /MSYS/} begin @@ -143,7 +143,7 @@ module Rscons # # @return [Array] Command used to execute commands. def command_executer=(val) - @@command_executer = val + @command_executer = val end end diff --git a/spec/rscons_spec.rb b/spec/rscons_spec.rb index 8f4d697..6c6660b 100644 --- a/spec/rscons_spec.rb +++ b/spec/rscons_spec.rb @@ -36,11 +36,11 @@ describe Rscons do describe ".get_system_shell" do before(:each) do - Rscons.class_variable_set(:@@shell, nil) + Rscons.instance_variable_set(:@shell, nil) end after(:each) do - Rscons.class_variable_set(:@@shell, nil) + Rscons.instance_variable_set(:@shell, nil) end it "uses the SHELL environment variable if it tests successfully" do @@ -80,11 +80,11 @@ describe Rscons do context "command executer" do describe ".command_executer" do before(:each) do - Rscons.class_variable_set(:@@command_executer, nil) + Rscons.instance_variable_set(:@command_executer, nil) end after(:each) do - Rscons.class_variable_set(:@@command_executer, nil) + Rscons.instance_variable_set(:@command_executer, nil) end it "returns ['env'] if mingw platform in MSYS and 'env' works" do @@ -115,10 +115,10 @@ describe Rscons do end describe ".command_executer=" do - it "overrides the value of @@command_executer" do - Rscons.class_variable_set(:@@command_executer, ["env"]) + it "overrides the value of @command_executer" do + Rscons.instance_variable_set(:@command_executer, ["env"]) Rscons.command_executer = [] - expect(Rscons.class_variable_get(:@@command_executer)).to eq([]) + expect(Rscons.instance_variable_get(:@command_executer)).to eq([]) end end end