Sha256: 5c0de354e299ac14f3cb1b5a7006c812cc45dcaad038c88c69c49f5f27dbac6d

Contents?: true

Size: 417 Bytes

Versions: 1

Compression:

Stored size: 417 Bytes

Contents

require 'active_support/inflector'

def modules *module_names, &block
  module_names.each do |name|
    class_eval %{
      module #{name.to_s.camelize}
        #{yield block if block}
      end
    }    
  end
end 

def nested_modules *module_names, &block
  module_names.inject([]) do |res, name|  
    res << %{
      module #{name.to_s.camelize}
        #{yield block if block}
      end}  
  end.join("\n")
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sugar-high-0.1.0 lib/sugar-high/module.rb