Output :-
Chandansingh
CHANDANSINGH
chandansingh
hgniSnadnahc
12
a
and
-------------------------------------------------------------- 5). Methods in Ruby :-
def add(x, y)
puts x+y
end
add 10, 20
def language(a, b)
puts "best language for beginner is #{a}"
puts "second best language for beginner is #{ b}"
end
language "Ruby", "Core java"
def name(x= "chandan", y ="Shreya")
puts "my name is #{x}"
puts "my friend name is #{y}"
end
name
name "adhiraj" , "ritu"
Output :-
30
best language for beginner is Ruby
second best language for beginner is Core java
my name is chandan
my friend name is Shreya
my name is adhiraj
my friend name is ritu
-------------------------------------------------------------- 6). How to pass multiple parameter in methods in Ruby :-
def multipara(*test)
puts "length of parameter is #{test.length}"
for i in 0..test.length-1
puts "Elements of parameter is #{test[i]}"
end
end
multipara "chandan", "Shina", "arti" ,"reena"
Output :-
length of parameter is 4
Elements of parameter is chandan
Elements of parameter is Shina
Elements of parameter is arti
Elements of parameter is reena
1). Go to the website "https://rubyinstaller.org/" or Click Here
2). Click the Download button as shown in below screen
3). Select the file as per your computer as below
For example : my system is window 7 32 bit, so i will select Ruby 2.5.1-2 (x86) file to download
4). If you are facing any problem then you can directly download from my google drive as below Click here to download Ruby from drive
Now double click on the setup and then click on Run button, then next .....as we install normal software.
5). To verify that ruby has been installed properly or not , open the commond prompt(cmd)
and Enter ruby -v and hit Enter key.
ruby version will appear and if so, congratulation ruby have installed in your machine.
6). To access "ruby interactive shell", type irb and hit Enter key as below
7). Now you can run your ruby program also from cmd as below
8). Download ruby editor Rubymine
a).go to the Url : https://www.jetbrains.com/ruby/download/ or click here
b).Click on the "Donwload" button to download the rubymine Click here to download from driver
9). Install the ruby mine in your machine
double click on setup file & then click run button as below
Now as normal software installation click on next button and the next if required the finish
Now select the Ruby 2.5.1 as shown below and click on install button
Now click the finish button
Now launch the ruby mine and if you are launching/opening it first time then select "Do not import" radio button as below
10). Create your project/file & run the ruby programs
Now select the Ruby option from open matching files in ruby mine as below :-
11). Create a simple ruby program to print name "chandan singh"
12). Install the cucumber in rubymine
open the commond prompt(cmd) and type the commond gem install cucumber and hit enter, as below