Module: Ruby::Overload

Defined in:
lib/ruby-overload/version.rb,
lib/ruby-overload/overload.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



42
43
44
45
46
# File 'lib/ruby-overload/overload.rb', line 42

def method_missing(method_name, *args, &blk)
  super unless self.class.respond_to_matching?(method_name, *args, &blk)

  self.class.matched_call(self, method_name, *args, &blk)
end

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/ruby-overload/overload.rb', line 5

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#respond_to_missing?(method_name) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/ruby-overload/overload.rb', line 48

def respond_to_missing?(method_name, *)
  self.class.respond_to_method?(method_name)
end