Type:
Class

Ruby supports two forms of objectified methods. Class Method is used to represent methods that are associated with a particular object: these method objects are bound to that object. Bound method objects for an object can be created using Object#method.

Ruby also supports unbound methods; methods objects that are not associated with a particular object. These can be created either by calling Module#instance_method or by calling unbind on a bound method object. The result of both of these is an UnboundMethod object.

Unbound methods can only be called after they are bound to an object. That object must be be a kind_of? the method's original class.

class Square
  def area
    @side * @side
  end
  def initialize(side)
    @side = side
  end
end

area_un = Square.instance_method(:area)

s = Square.new(12)
area = area_un.bind(s)
area.call   #=> 144

Unbound methods are a reference to the method at the time it was objectified: subsequent changes to the underlying class will not affect the unbound method.

class Test
  def test
    :original
  end
end
um = Test.instance_method(:test)
class Test
  def test
    :modified
  end
end
t = Test.new
t.test            #=> :modified
um.bind(t).call   #=> :original
clone

method.clone â new_method Instance Public methods Returns a clone of this method

2015-06-09 23:22:53
hash

meth.hash â integer Instance Public methods Returns a hash value corresponding

2015-06-09 23:33:30
parameters

meth.parameters â array Instance Public methods Returns the parameter information

2015-06-09 23:50:49
name

meth.name â symbol Instance Public methods Returns the name of the method

2015-06-09 23:39:44
to_s

meth.to_s â string Instance Public methods Returns the name of the underlying

2015-06-09 23:54:57
source_location

meth.source_location â [String, Fixnum] Instance Public methods Returns the

2015-06-09 23:52:23
eql?

meth == other_meth â true or false Instance Public methods Two method objects

2015-06-09 23:27:50
inspect

meth.inspect â string Instance Public methods Returns the name of the underlying

2015-06-09 23:36:15
==

meth == other_meth â true or false Instance Public methods Two method objects

2015-06-09 23:07:27
owner

meth.owner â class_or_module Instance Public methods Returns the class or

2015-06-09 23:45:31