Skip to content

Instantly share code, notes, and snippets.

@tell-k
Created July 10, 2013 04:41
Show Gist options
  • Save tell-k/5963525 to your computer and use it in GitHub Desktop.
Save tell-k/5963525 to your computer and use it in GitHub Desktop.
class Point
attr_accessor :user
def initialize(user)
@user = user
end
def calc_point_num
unless self.user.point_num
return 101
end
100
end
end
DummyUser = Class.new do
def initialize(point_num)
@point_num = point_num
end
attr_reader :point_num
end
user = DummyUser.new(10)
point = Point.new(user)
puts point.calc_point_num
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment