Module: Ruote::WithMeta

Included in:
Exp::FlowExpression
Defined in:
lib/ruote/util/ometa.rb

Overview

meta a la lucky stiff

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(target) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/ruote/util/ometa.rb', line 36

def self.included(target)

  def target.metaclass
    class << self
      self
    end
  end
  def target.meta_eval(&block)
    metaclass.instance_eval(&block)
  end
  def target.meta_def(method_name, &block)
    meta_eval { define_method method_name, &block }
  end
  def class_def(method_name, &block)
    class_eval { define_method name, &block }
  end
end

Instance Method Details

#class_def(method_name, &block) ⇒ Object



49
50
51
# File 'lib/ruote/util/ometa.rb', line 49

def class_def(method_name, &block)
  class_eval { define_method name, &block }
end