This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
values = %w[ ride the dragon ] | |
lengths = Hash[values.map { |e| [e, e.length] }] | |
#=> {"ride"=>4, "the"=>3, "dragon"=>6} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$VERBOSE = nil | |
require File.expand_path('../rooby', __FILE__) | |
Person = Rooby::Class.new 'Person' do | |
define :initialize do |name| | |
@name = name | |
end | |
define :name do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A solution for Ruby quiz #234 - Random Points within a Circle. | |
# http://rubyquiz.strd6.com/quizzes/234-random-points-within-a-circle | |
# Yaser Sulaiman. | |
class Point | |
attr_accessor :x, :y | |
def initialize(x = 0, y = 0) | |
@x, @y = x, y | |
end |