Class: Introspection::Method

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/introspection/method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, visibility = :public) ⇒ Method

Returns a new instance of Method.


12
13
14
# File 'lib/introspection/method.rb', line 12

def initialize(method, visibility = :public)
  @method, @visibility = method, visibility
end

Instance Attribute Details

#visibilityObject (readonly)

Returns the value of attribute visibility


10
11
12
# File 'lib/introspection/method.rb', line 10

def visibility
  @visibility
end

Instance Method Details

#==(other) ⇒ Object


16
17
18
# File 'lib/introspection/method.rb', line 16

def ==(other)
  (owner == other.owner) && (name == other.name) && (visibility == other.visibility)
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)

20
21
22
# File 'lib/introspection/method.rb', line 20

def eql?(other)
  (self.class === other) && (self == other)
end

#hashObject


24
25
26
# File 'lib/introspection/method.rb', line 24

def hash
  [owner, name, visibility].hash
end

#inspectObject


32
33
34
# File 'lib/introspection/method.rb', line 32

def inspect
  "#{owner}##{name} (#{visibility})"
end

#nameObject


28
29
30
# File 'lib/introspection/method.rb', line 28

def name
  @method.name.to_sym
end