Module: Liquidscript::Compiler::ICR::Directives

Included in:
Liquidscript::Compiler::ICR
Defined in:
lib/liquidscript/compiler/icr/directives.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object



103
104
105
106
107
108
109
110
111
112
# File 'lib/liquidscript/compiler/icr/directives.rb', line 103

def self.included(receiver)
  receiver.extend         ClassMethods
  receiver.send :include, InstanceMethods

  InstanceMethods.instance_methods.each do |m|
    if m.to_s =~ /\A_?directive_([A-Za-z0-9\_]+)\z/
      receiver.define_directive($1.gsub(/\_[a-z]/) { |m| m[1].upcase }, m)
    end
  end
end