Skip to content

Instantly share code, notes, and snippets.

@dasch
Created February 12, 2012 12:10
Show Gist options
  • Save dasch/1808214 to your computer and use it in GitHub Desktop.
Save dasch/1808214 to your computer and use it in GitHub Desktop.
class RockScore
def initialize(value)
@value = value
end
def available?
!@value.nil?
end
def value
# Alternatively, have a NoScore that just raises
# when #value is called and keep this as a simple
# reader.
if @value.nil?
raise "WAT!"
else
@value
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment