Module: Becoming

Defined in:
lib/becoming.rb,
lib/becoming/version.rb

Constant Summary collapse

VERSION =
"1.0.0"

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &blk) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/becoming.rb', line 8

def method_missing(m, *args, &blk)
  if @becoming && @becoming.public_method_defined?(m)
    @becoming.instance_method(m).bind(self).call(*args, &blk)
  else
    super
  end
end

Instance Method Details

#becoming(mod) ⇒ Object



4
5
6
# File 'lib/becoming.rb', line 4

def becoming(mod)
  @becoming = mod    
end

#respond_to_missing?(m, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
# File 'lib/becoming.rb', line 16

def respond_to_missing?(m, include_all=false)
  if @becoming && @becoming.public_method_defined?(m)
    true
  else
    super
  end
end