Created
July 10, 2013 04:41
-
-
Save tell-k/5963525 to your computer and use it in GitHub Desktop.
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 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