A Programming Language for Lazy People - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

A Programming Language for Lazy People

Description:

A Programming Language for Lazy People – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 9
Provided by: nord8
Category:

less

Transcript and Presenter's Notes

Title: A Programming Language for Lazy People


1
(No Transcript)
2
A Programming Language for Lazy People
3
String and Array Arithmetic
"foo" 3
"foofoofoo"
1,2,3 - 2,3
1
1,2,3 2,3
2,3
Open Webpage as File
require "open-uri" open("http//www.example.com/")
do page parse page and do stuff end
Sort Objects by Attributes
people.sort_by do p p.last_name,
p.first_name, p.middle_initial end
4
Blocks Allow Powerful Constructs
5
Blocks in Java
for(String s myStringArray)
System.out.printLine(s)
synchronized(dbHandler) // access database
In Ruby, Any Method Can Have a Block
1, 2, 3.each do i puts i 2 end
2 4 6
File.open(file.txt) do f f.each_line do
l puts line end end
6
Generate Markup
markaby.html do head title "Boats.com"
body do h1 "Boats.com has great deals" ul
do li "49 for a canoe" li "39 for a
raft" end end end From Markaby
documentation
lthtmlgt ltheadgtlttitlegtBoats.comlt/titlegtlt/headgt
ltbodygt...lt/bodygt lt/htmlgt
7
Dynamic Nothing is Final
8
Open Classes
Class String def leet_speak self.sub(" e",
" 3") end End "Me likes ruby".leet_speak
"M3 lik3s ruby"
Test Assertions in English
require 'test/spec ... (2 3).should
5 ... my_method.should.not.raise
ConnectionError From Test/Unit documentation
Write a Comment
User Comments (0)
About PowerShow.com