class Gear
attr_reader :chainring, :cog, :wheel
def initialize(chainring, cog, wheel)
@chainring = chainring
@cog = cog
@wheel = wheel
end
...
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
$: << File.dirname(__FILE__)+'/../lib' | |
require 'ice_cube' | |
require 'benchmark' | |
include IceCube | |
schedule = Schedule.new(now = Time.utc(2010, 1, 1)) do |s| | |
s.add_recurrence_rule(Rule.hourly(2)) | |
end |
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
class PlainModel | |
include ActiveModel::Model | |
include ActiveSupport::Callbacks | |
include ActiveModel::Validations::Callbacks | |
define_callbacks :save | |
def save | |
if valid? |
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
class RPNCalculator | |
attr_accessor :calculator | |
def initialize | |
@calculator = [] | |
end | |
def push(x) | |
@calculator << x | |
end |