Skip to content

Commit bbf8d26

Browse files
committed
about_proxy_object_project
1 parent 186f27c commit bbf8d26

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

.path_progress

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
0,1,2,5,6
22
,8,9,10,13,15,16
33
,18,18,19,20,20,21,22,23,24,32,33,35,35,37,39,40,41,42,42,42,43,44,46,49,50,51,52,55,56,59,60,60,61,63,64,65,67
4-
,70,71,73,74,75,75,76,77,78,79,81,81,82,84,84,85,85,87,88,90,91,93,94,96,98,99,99,100,101,103,104,106,107,107,108,109,111,111,114,115,116,116,116,117,119,121,122,123,124,125,127,128,130,130,131,132,134,135,139,141,143,145,146,149,150,151,153,151,153,153,153,154,154,154,155,158,159,159,160,163,166,166,167,167,168,172,173,176,177,178,178,181,182,187,187,187,190,191,191,192,192,195,199,200,203,202,203,204,205,205,205,205,206,207,209,210,210,210,214,210,217,220,220,221,221,224,226,228,228,230,232,232,233,234,234,235,238,240,242,244,244,245,253,253,256,258,259,259,259,259,260,261,261,263,265
4+
,70,71,73,74,75,75,76,77,78,79,81,81,82,84,84,85,85,87,88,90,91,93,94,96,98,99,99,100,101,103,104,106,107,107,108,109,111,111,114,115,116,116,116,117,119,121,122,123,124,125,127,128,130,130,131,132,134,135,139,141,143,145,146,149,150,151,153,151,153,153,153,154,154,154,155,158,159,159,160,163,166,166,167,167,168,172,173,176,177,178,178,181,182,187,187,187,190,191,191,192,192,195,199,200,203,202,203,204,205,205,205,205,206,207,209,210,210,210,214,210,217,220,220,221,221,224,226,228,228,230,232,232,233,234,234,235,238,240,242,244,244,245,253,253,256,258,259,259,259,259,260,261,261,263,265,265,266,266,265,266,268,269,269,275

about_proxy_object_project.rb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,25 @@
1515
class Proxy
1616
def initialize(target_object)
1717
@object = target_object
18-
# ADD MORE CODE HERE
18+
@messages = Hash.new(0)
1919
end
2020

21-
# WRITE CODE HERE
21+
def messages
22+
@messages.keys
23+
end
24+
25+
def called?(method_name)
26+
@messages.has_key?(method_name)
27+
end
28+
29+
def number_of_times_called(method_name)
30+
@messages[method_name]
31+
end
32+
33+
def method_missing(method_name, *args, &block)
34+
@messages[method_name] += 1
35+
@object.send(method_name, *args, &block)
36+
end
2237
end
2338

2439
# The proxy object should pass the following Koan:

0 commit comments

Comments
 (0)