This file contains hidden or 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
module StringCalculator | |
String.class_eval do | |
def calc | |
raise NoNegativeNumbers.new(numbers.select{|n| n < 0}) if numbers.any?{|n| n < 0} | |
numbers.inject(0, &:+) | |
end | |
private |
This file contains hidden or 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 Bowling | |
def initialize | |
@rolls = [] | |
end | |
def roll(pins) | |
@rolls << pins | |
end |
This file contains hidden or 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
## Customize the test machine | |
machine: | |
timezone: | |
America/Los_Angeles # Set the timezone | |
# Version of ruby to use | |
ruby: | |
version: | |
1.9.3-p392 |
NewerOlder