Class: Ov::OverrideMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/ov/ov_method.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, types, owner, body = proc{}) ⇒ OverrideMethod

name (Symbol) : name for method types (Array) : array with types, for method arguments body (Proc) : block called with method



8
9
10
11
12
13
# File 'lib/ov/ov_method.rb', line 8

def initialize(name, types, owner, body = proc{})
  @name, @types, @owner, @body = name, types, owner, body
  @ancestors = owner.ancestors.find_all do |ancestor| 
    ancestor.method_defined?(:__overload_methods) && ancestor.class == Class
  end 
end

Instance Attribute Details

#ancestorsObject

Returns the value of attribute ancestors.



3
4
5
# File 'lib/ov/ov_method.rb', line 3

def ancestors
  @ancestors
end

#bodyObject

Returns the value of attribute body.



3
4
5
# File 'lib/ov/ov_method.rb', line 3

def body
  @body
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/ov/ov_method.rb', line 3

def name
  @name
end

#ownerObject

Returns the value of attribute owner.



3
4
5
# File 'lib/ov/ov_method.rb', line 3

def owner
  @owner
end

#typesObject

Returns the value of attribute types.



3
4
5
# File 'lib/ov/ov_method.rb', line 3

def types
  @types
end

Instance Method Details

#eql0?(other) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


20
21
22
23
24
25
26
# File 'lib/ov/ov_method.rb', line 20

def eql0?(other) #:nodoc:
  @ancestors.find{|a|
    a.__overload_methods.find{|m| 
      m.name == other.name && m.types == other.types 
    }
  }
end

#eql?(other) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/ov/ov_method.rb', line 15

def eql?(other) #:nodoc:
  return true if @name == other.name && @types == other.types && @owner == other.owner
  false
end

#like0?(other) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


33
34
35
36
37
38
39
# File 'lib/ov/ov_method.rb', line 33

def like0?(other) #:nodoc:
  @ancestors.find{|a| 
    a.__overload_methods.find{|m| 
      m.like?(other) 
    }
  }
end

#like?(other) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


28
29
30
31
# File 'lib/ov/ov_method.rb', line 28

def like?(other) #:nodoc:
  return compare?(types, other.types) if @name == other.name 
  false
end