Method: Carrot::AMQP::Protocol::Class.Method

Defined in:
lib/amqp/spec.rb

.Method(id, name) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/amqp/spec.rb', line 101

def self.Method(id, name)
  @_base_methods ||= {}
  @_base_methods[id] ||= ::Class.new(Method) do
    class_eval %[
      def self.inherited klass
        klass.const_set(:ID, #{id})
        klass.const_set(:NAME, :#{name.to_s})
        klass.parent.methods[#{id}] = klass
        klass.parent.methods[klass::NAME] = klass
      end
    ]
  end
end