Upload
mohamed-ahmed-sabry
View
223
Download
0
Embed Size (px)
DESCRIPTION
Â
Citation preview
Methods
Stringscapitalize!
centerchomp!
chop!concatcountcrypt
delete!downcase!
dumpeach
each_byteempty?
gsub!hashhex
include?indexinternlength
ljust, rjustnext!
octreplace
reverse!rindex
scanslice!split
squeeze!strip!sub!sum
swapcase!tr!
tr_s!unpackupcase!
upto
Regexescape
last_matchnew
quotecasefold?
kcodematchsource
Time
asctimectime
daygmt?
gmtimehourisdst
localtimemday
minmon
monthsec
strftimetv_sec
tv_usecusec
utcutc?
wdayydayyearzone
Methods Arraysassocatclearcollect!compact!concatdeletedelete_atdelete_ifeacheach_indexempty?eql?fillfirstflatten!include?indexindexesjoinlastlengthnitemspackpoppushrassocreject!replacereverse!reverse_eachrindexshiftslice!sort!uniq!unshift
Validationcondition_block?create!evaluate_conditionvalidatevalidate_on_createvalidate_on_updatevalidates_acceptance_ofvalidates_associatedvalidates_confirmation_ofvalidates_eachvalidates_exclusion_ofvalidates_format_ofvalidates_inclusion_ofvalidates_length_ofvalidates_numericality_ofvalidates_presence_ofvalidates_size_ofvalidates_uniqueness_of
Enumerable Mixincollecteach_with_indexentriesfindfind_allgrepinclude?maxminrejectsort
Available free from AddedBytes.com
Ruby on Rails Logo used with permission.
REGULAR EXPRESSIONS SYNTAX
^
$
.
(a|b)
(...)
[abc]
[^abc]
a?
a*
a+
a{3}
a{3,}
a{3,6}
!(pattern)
Start of string
End of string
Any single character
a or b
Group section
Item in range (a or b or c)
Not in range (not a or b or c)
Zero or one of a
Zero or more of a
One or more of a
Exactly 3 of a
3 or more of a
Between 3 and 6 of a
"Not" prefix. Apply rule when
URL does not match pattern.
METHODS NOTE
! - Denotes where a tailing ! may be
! - used. A colourless ! denotes that the
! - ! is compulsory.
DEFAULT DIRECTORY STRUCTURE
rails_root
app
apis
controllers
application.rb
helpers
application_helper.rb
models
views
layouts
components
config
environments
development.rb
production.rb
test.rb
database.yml
environment.rb
routes.rb
db
doc
lib
log
development.log
production.log
server.log
test.log
public
images
javascripts
controls.js
dragdrop.js
effects.js
prototype.js
stylesheets
.htaccess
404.html
500.html
dispatch.cgi
dispatch.fcgi
dispatch.rb
favicon.ico
index.html
script
test
fixtures
functional
mocks
development
test
unit
test_helper.rb
vendor
PRE-DEFINED VARIABLES
$!
$&
$`
$'
$+
$N
$=
$/
$\
$,
$.
$>
$_
$0
$*
$stderr
$stdin
$stdout
$-a
$-d
$-l
$-p
$-v
Exception information
String of last match
String left of last match
String right of last match
Last group of last match
Nth group of last match
Case insensitive flag
Input record separator
Output record separator
Output field separator
Current line number of
last file read
Default output for print
Last input line of string
Name of script
Command line arguments
Standard error output
Standard input
Standard output
True if -a is set.
Status of -d switch
True if -l is set
True if -p is set
Verbose Flag
RESERVED WORDS
=begin
=end
BEGIN
END
alias
and
begin
break
case
class
def
defined?
do
else
elsif
end
ensure
false
for
if
in
module
next
nil
not
or
redo
rescue
retry
return
self
super
then
true
undef
unless
until
when
while
yield