To start with, we need to create "Cucumber" folder with mkdir Cucumber
in "Terminal".
Open "Cucumber" folder and create "lib" folder to hold calculator functionality file.
cd Cucumber
mkdir lib
Now, we need to open "lib" folder and add a file "calculator.rb".
cd lib
touch calculator.rb
Then edit it as following and save:
class Calculator
def push(n)
@args ||= []
@args << n
end
def add
@args.inject(0){|n,sum| sum+=n}
end
def divide
@args[0].to_f / @args[1].to_f
end
end