1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class InspectUsage
def initialize(obj)
@object = obj
end
def method_missing(name, *args, &block)
puts "Call method(#{@object}): #{name} (#{args} #{block})"
@object.send name, *args, &block
end
end
str = InspectUsage.new "Hello"
puts str.size
array = InspectUsage.new [1,2,3]
puts array.reduce &:+
proc = InspectUsage.new( proc { puts 'hello' })
puts str.gsub /.*/, &proc
Enter to Rename, Shift+Enter to Preview