SlideShare a Scribd company logo
1 of 106
Download to read offline
I am Vysakh.
I am a web developer.
In Ruby
puts “Hello world”
Ruby is simply simple
Just like english
Variables
You have
- basket A with 10 apples
- basket B with 20 apples.
Find the sum and
difference
basketa = 10 apples
basketb = 20 apples
sum = basketa + basketb
=> 10 + 20 = 30
difference = basketb - basketa
=> 20 - 10 = 10
basket_a = 10
basket_b = 20
sum = basket_a + basket_b
difference = basket_b - basket_a
In Ruby
It is just like what you wrote in your
kindergarden answer sheet
Creator of Ruby - Matz
Running the code
Ruby is executed line by line
So output of a single line/logic can be seen
using irb
Opening up irb in the terminal
Instead of executing as a program file. Useful
for learning, debugging.
Conditionals
cold_weather = true
if cold_weather
puts “Wear something warm”
else
puts “Don’t wear something”
end
Ruby code
Most thing in Ruby is Object
2.odd?()
=> false
“Vysakh”.length()
=> 6
Brackets are optional in Ruby
2.odd?
=> false
“Vysakh”.length
=> 6
Exercise 1
a) Get a string and check if it is palindrome.
b) Get a number and print the reverse of it.
Hint: use gets to get the input.
Array/List
In Ruby
shopping = [ “milk”, “cheese”, “olive oil”]
Loops
In Ruby
20.times do
puts “I must do my homework”
end
Also, there are
- loop
- while loop
- for loop
- step
- upto
HAPPY
Ruby is all about making programmer
Mam, please take
each item for me to
bill
cart = [“biscuit”, milk”, “shampoo”, “tampons” ]
Mam, please take
each item for me to
bill
cart = [“biscuit”, milk”, “shampoo”, “tampons” ]
cart.each do |item|
puts item
end
Exercise 2
- Create an array of marks you got in your
last assessment.
- Find if the sum of odd numbers is greater
than the sum of even numbers, if it is, you
have big odds at passing.
- Pass this information or bad luck will follow
HASH
In Ruby
slang = {
“lol” => “laugh out loud”,
“brb” => “Be right back”
}
slang[“lol”]
=> laught out loud
Use symbols instead of string
slang = {
:lol => “laugh out loud”,
:brb => “Be right back”
}
slang[:lol]
=> laught out loud
Symbols in Ruby
:hand.class
=> Symbol
Alternate way to write hash
slang = {
lol: “laugh out loud”,
brb: “Be right back”
}
slang[:lol]
=> laught out loud
Exercise 3
- Create a list of ipl team hashes
- with batsmen (3) name as key and their
sixes as values.
a) Find the sixes hit by a batsmen of a given
name
Functions
In Ruby
def y(x)
x**3
end
y(3) # => 27
y(2) # => 8
Exercise 4
a) Create a method rajini_style. Return his
dialogue (your favorite).
b) Create a factorial method that gets a
number and returns the factorial
Class
class Sports
def initialize(players, name)
@no_of_players = players
@name = name
end
end
cricket = Sports.new(11, “Cricket”)
foot_ball = Sports.new(11, “Football”)
Inheritance
a version manager (RVM or rbenv or other)
Install ruby using
rbenv
Installing Ruby using
Installing and setting Ruby
dhh
Creator of Ruby on Rails
Installing Rails
Creating a new rails project
Files generated with “rails new
myproject” command
Starting Rails server
Check the browser
localhost:3000
Understanding Rails
A dress shop
Pant
section?
1st floor
kid. 2nd
section
1st floor
here is
your pant
A Rails server
/about
routes.rb
home
controller,
about
action
A Rails server
home controller,
about action
here is
your html
file
Lets do it in Rails
filename: config/routes.rb
Configure the routes to get /about
The corresponding html
and go to ‘/about’ url
Lets open the browser
available in the section?
When the pant is not
Coming back to the kid and pant story
1st floor
I want this
specific
design
Godown
Oh kid
lemme go
to the
godown
and get
In Rails
Database
home controller,
about action
/posts/1
and have an abstraction(model)
Lets create a table
This will create model,
migration files
migration - A ruby file that will create, modify
tables
posts table
title column of type
string
from the ruby file(migration)
Lets create the tables
Rake, a simple ruby build program with
capabilities similar to make
This creates the posts table
table records through Rails model
Lets create, manipulate
Post is a Ruby class that Inherits ActiveRecord
app/models/post.rb
Object Relation Mapping(ORM) layer
Active Record is an
tables map to classes,
rows map to objects
rows map to objects
Rows map to objects
Columns map to object attributes
Few operations
Lets use this query in
Rails controller and give it to the user
Configure the routes file
Open up the browser
Show the title, description in html
app/views/show.html.erb
Now lets check the browser
Now lets do all this in
one command -> scaffold
This will generate all files
based on REST Architecture
Guides and resources
http://tryruby.org
http://www.codecademy.com/en/tracks/ruby
http://ruby.learncodethehardway.org/book/
Ruby
Ruby on Rails
railstutorial.org/book
railsforzombies.org
guides.rubyonrails.org/getting_started
railscasts.com
Local Ruby Community - chennair.b
Mailing list - google groups
Meetups - www.meetup.com/chennai-ruby
americansyscorp b/o ascitconsultancyservices

More Related Content

Viewers also liked

VIKASSINGH_RESUME
VIKASSINGH_RESUMEVIKASSINGH_RESUME
VIKASSINGH_RESUME
Vikas Singh
 
Ebony drugs front & back cover
Ebony drugs front & back coverEbony drugs front & back cover
Ebony drugs front & back cover
mspenner
 
Reference Letter from Emily
Reference Letter from EmilyReference Letter from Emily
Reference Letter from Emily
Nancy Ahlers
 
6 data types
6 data types6 data types
6 data types
jigeno
 
15 functional programming
15 functional programming15 functional programming
15 functional programming
jigeno
 

Viewers also liked (16)

πειραματικό λύκειο μυτιλήνης ελμε προτύπων και πειραματικών.
πειραματικό λύκειο μυτιλήνης   ελμε προτύπων και πειραματικών.πειραματικό λύκειο μυτιλήνης   ελμε προτύπων και πειραματικών.
πειραματικό λύκειο μυτιλήνης ελμε προτύπων και πειραματικών.
 
2013 Travel Agency Industry Overview
2013 Travel Agency Industry Overview2013 Travel Agency Industry Overview
2013 Travel Agency Industry Overview
 
Y server
Y serverY server
Y server
 
VIKASSINGH_RESUME
VIKASSINGH_RESUMEVIKASSINGH_RESUME
VIKASSINGH_RESUME
 
Fabaceas%20sub%20family
Fabaceas%20sub%20familyFabaceas%20sub%20family
Fabaceas%20sub%20family
 
المنيو
المنيوالمنيو
المنيو
 
Big data and hadoop introduction
Big data and hadoop introductionBig data and hadoop introduction
Big data and hadoop introduction
 
Ebony drugs front & back cover
Ebony drugs front & back coverEbony drugs front & back cover
Ebony drugs front & back cover
 
Teatro y dramatizacion_en_la_escuela
Teatro y dramatizacion_en_la_escuelaTeatro y dramatizacion_en_la_escuela
Teatro y dramatizacion_en_la_escuela
 
Reference Letter from Emily
Reference Letter from EmilyReference Letter from Emily
Reference Letter from Emily
 
Taller recreación infantil.ubj
Taller recreación infantil.ubjTaller recreación infantil.ubj
Taller recreación infantil.ubj
 
6 data types
6 data types6 data types
6 data types
 
15 functional programming
15 functional programming15 functional programming
15 functional programming
 
GMO - Bayi tabung
GMO - Bayi tabungGMO - Bayi tabung
GMO - Bayi tabung
 
Edelweiss financial services broking ltd
Edelweiss financial services broking ltdEdelweiss financial services broking ltd
Edelweiss financial services broking ltd
 
Masail Fiqhiyyah - Bayi Tabung dan Kloning
Masail Fiqhiyyah - Bayi Tabung dan KloningMasail Fiqhiyyah - Bayi Tabung dan Kloning
Masail Fiqhiyyah - Bayi Tabung dan Kloning
 

Similar to americansyscorp b/o ascitconsultancyservices

Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
Manoj Kumar
 
A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends
旻琦 潘
 
Uses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsUses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & Stubs
PatchSpace Ltd
 
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and JasmineRails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Raimonds Simanovskis
 

Similar to americansyscorp b/o ascitconsultancyservices (20)

Ruby and Rails by Example (GeekCamp edition)
Ruby and Rails by Example (GeekCamp edition)Ruby and Rails by Example (GeekCamp edition)
Ruby and Rails by Example (GeekCamp edition)
 
Ruby Gotchas
Ruby GotchasRuby Gotchas
Ruby Gotchas
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends
 
Reasons To Love Ruby
Reasons To Love RubyReasons To Love Ruby
Reasons To Love Ruby
 
Ruby
RubyRuby
Ruby
 
Playfulness at Work
Playfulness at WorkPlayfulness at Work
Playfulness at Work
 
Uses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsUses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & Stubs
 
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
 
Threequals - Case Equality in Ruby
Threequals - Case Equality in RubyThreequals - Case Equality in Ruby
Threequals - Case Equality in Ruby
 
Real life-coffeescript
Real life-coffeescriptReal life-coffeescript
Real life-coffeescript
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and JasmineRails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
 
Fewd week5 slides
Fewd week5 slidesFewd week5 slides
Fewd week5 slides
 
lab4_php
lab4_phplab4_php
lab4_php
 
lab4_php
lab4_phplab4_php
lab4_php
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
 
Ruby Gotchas
Ruby GotchasRuby Gotchas
Ruby Gotchas
 
Ruby Programming Language - Introduction
Ruby Programming Language - IntroductionRuby Programming Language - Introduction
Ruby Programming Language - Introduction
 

More from Carmor Bass

gocareerguide-your on the go career guidance-www.gocareerguide.com
gocareerguide-your on the go career guidance-www.gocareerguide.comgocareerguide-your on the go career guidance-www.gocareerguide.com
gocareerguide-your on the go career guidance-www.gocareerguide.com
Carmor Bass
 
Askbytes.com-Guide for success-askbytes
Askbytes.com-Guide for success-askbytesAskbytes.com-Guide for success-askbytes
Askbytes.com-Guide for success-askbytes
Carmor Bass
 
Askbytes habit to ask better-askbytes.com
Askbytes habit to ask better-askbytes.comAskbytes habit to ask better-askbytes.com
Askbytes habit to ask better-askbytes.com
Carmor Bass
 

More from Carmor Bass (11)

Api details for american syscorp
Api details for american syscorpApi details for american syscorp
Api details for american syscorp
 
gocareerguide-Careerdevelopment by gocareerguide.com
gocareerguide-Careerdevelopment by gocareerguide.comgocareerguide-Careerdevelopment by gocareerguide.com
gocareerguide-Careerdevelopment by gocareerguide.com
 
gocareerguide-your on the go career guidance-www.gocareerguide.com
gocareerguide-your on the go career guidance-www.gocareerguide.comgocareerguide-your on the go career guidance-www.gocareerguide.com
gocareerguide-your on the go career guidance-www.gocareerguide.com
 
ascitconsultancy-scalable-javascript-application-architecture for ascitconsul...
ascitconsultancy-scalable-javascript-application-architecture for ascitconsul...ascitconsultancy-scalable-javascript-application-architecture for ascitconsul...
ascitconsultancy-scalable-javascript-application-architecture for ascitconsul...
 
Ascitconsultancy american history in details-ascitconsultancy.com
Ascitconsultancy american history in details-ascitconsultancy.comAscitconsultancy american history in details-ascitconsultancy.com
Ascitconsultancy american history in details-ascitconsultancy.com
 
99careerbuilder guide for success-99careerbuilder.com
99careerbuilder guide for success-99careerbuilder.com99careerbuilder guide for success-99careerbuilder.com
99careerbuilder guide for success-99careerbuilder.com
 
Askbytes.com-Guide for success-askbytes
Askbytes.com-Guide for success-askbytesAskbytes.com-Guide for success-askbytes
Askbytes.com-Guide for success-askbytes
 
Askbytes habit to ask better-askbytes.com
Askbytes habit to ask better-askbytes.comAskbytes habit to ask better-askbytes.com
Askbytes habit to ask better-askbytes.com
 
API Details For Ascitconsultancyservices.com
API Details For Ascitconsultancyservices.comAPI Details For Ascitconsultancyservices.com
API Details For Ascitconsultancyservices.com
 
Mobile Ecosystem in 2015 by AscITconsultancyservices
Mobile Ecosystem in 2015 by AscITconsultancyservicesMobile Ecosystem in 2015 by AscITconsultancyservices
Mobile Ecosystem in 2015 by AscITconsultancyservices
 
Ecareerplanner- technology and education (www.ecareerplanner.com)
Ecareerplanner- technology and education (www.ecareerplanner.com)Ecareerplanner- technology and education (www.ecareerplanner.com)
Ecareerplanner- technology and education (www.ecareerplanner.com)
 

Recently uploaded

audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
lolsDocherty
 
Production 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxProduction 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptx
ChloeMeadows1
 

Recently uploaded (16)

Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital PresenceCyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
 
I’ll See Y’All Motherfuckers In Game 7 Shirt
I’ll See Y’All Motherfuckers In Game 7 ShirtI’ll See Y’All Motherfuckers In Game 7 Shirt
I’ll See Y’All Motherfuckers In Game 7 Shirt
 
The Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyThe Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case Study
 
Reggie miller choke t shirtsReggie miller choke t shirts
Reggie miller choke t shirtsReggie miller choke t shirtsReggie miller choke t shirtsReggie miller choke t shirts
Reggie miller choke t shirtsReggie miller choke t shirts
 
Development Lifecycle.pptx for the secure development of apps
Development Lifecycle.pptx for the secure development of appsDevelopment Lifecycle.pptx for the secure development of apps
Development Lifecycle.pptx for the secure development of apps
 
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
 
Pvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdf
 
Topology of the Network class 8 .ppt pdf
Topology of the Network class 8 .ppt pdfTopology of the Network class 8 .ppt pdf
Topology of the Network class 8 .ppt pdf
 
iThome_CYBERSEC2024_Drive_Into_the_DarkWeb
iThome_CYBERSEC2024_Drive_Into_the_DarkWebiThome_CYBERSEC2024_Drive_Into_the_DarkWeb
iThome_CYBERSEC2024_Drive_Into_the_DarkWeb
 
Statistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdfStatistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdf
 
TORTOGEL TELAH MENJADI SALAH SATU PLATFORM PERMAINAN PALING FAVORIT.
TORTOGEL TELAH MENJADI SALAH SATU PLATFORM PERMAINAN PALING FAVORIT.TORTOGEL TELAH MENJADI SALAH SATU PLATFORM PERMAINAN PALING FAVORIT.
TORTOGEL TELAH MENJADI SALAH SATU PLATFORM PERMAINAN PALING FAVORIT.
 
How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?
 
Production 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxProduction 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptx
 
Bug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's GuideBug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's Guide
 
Premier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdfPremier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdf
 
Thank You Luv I’ll Never Walk Alone Again T shirts
Thank You Luv I’ll Never Walk Alone Again T shirtsThank You Luv I’ll Never Walk Alone Again T shirts
Thank You Luv I’ll Never Walk Alone Again T shirts
 

americansyscorp b/o ascitconsultancyservices