Class: Ov::OverrideMethod
- Inherits:
-
Object
- Object
- Ov::OverrideMethod
- Defined in:
- lib/ov/ov_method.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#ancestors ⇒ Object
Returns the value of attribute ancestors.
-
#body ⇒ Object
Returns the value of attribute body.
-
#name ⇒ Object
Returns the value of attribute name.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#types ⇒ Object
Returns the value of attribute types.
Instance Method Summary collapse
-
#eql0?(other) ⇒ Boolean
:nodoc:.
-
#eql?(other) ⇒ Boolean
:nodoc:.
-
#initialize(name, types, owner, body = proc{}) ⇒ OverrideMethod
constructor
name
(Symbol) : name for methodtypes
(Array) : array with types, for method argumentsbody
(Proc) : block called with method. -
#like0?(other) ⇒ Boolean
:nodoc:.
-
#like?(other) ⇒ Boolean
:nodoc:.
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
#ancestors ⇒ Object
Returns the value of attribute ancestors.
3 4 5 |
# File 'lib/ov/ov_method.rb', line 3 def ancestors @ancestors end |
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/ov/ov_method.rb', line 3 def body @body end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/ov/ov_method.rb', line 3 def name @name end |
#owner ⇒ Object
Returns the value of attribute owner.
3 4 5 |
# File 'lib/ov/ov_method.rb', line 3 def owner @owner end |
#types ⇒ Object
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:
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:
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:
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:
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 |