Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

[ruby-docorg]

Convert a String to a Range
Tuesday, 13 April 2010 10:06

s = "2..5"
Range.new *s.split('..').map(&:to_i)
#=> 2..5


Resources:
- Class: Range [ruby-doc.org]

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/22gYmHs7jrA/11019

 
Create a random number in Ruby
Friday, 19 March 2010 16:48
Return a value from 0 to 5:
rand(6)

Return a value between 0 and 1:
rand

Resources:
- Module: Kernel [ruby-doc.org]

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/aIaVxWHYbAE/10611

 


Taxonomy by Zaragoza Online