Sha256: 6b4bbdb4cc2c71449b10c538642803f0de13d21abad35a4c24af17067d4ed763

Contents?: true

Size: 987 Bytes

Versions: 39

Compression:

Stored size: 987 Bytes

Contents

require 'active_support/inflector'
require 'sugar-high/array'

class Module
  [:include, :extend].each do |name|
    plural = name.to_s.pluralize
    class_eval %{
      def #{plural} *module_names
        module_names.to_symbols.each do |name|
          class_eval %{
            #{name} \#{name.to_s.camelize}
          }    
        end
      end 

      def #{name}_from module_name, *sub_modules
        sub_modules.to_symbols.each do |name|
          class_eval %{
            #{name} \#{module_name.to_s.camelize}::\#{name.to_s.camelize}
          }    
        end
      end       
    }
  end
  
  def includes_and_extends *module_names
    includes module_names
    extends module_names
  end    

  def includes_and_extends_from module_name, *sub_modules
    includes module_name, *sub_modules
    extends module_name, *sub_modules
  end    

  alias_method :extends_and_includes, :includes_and_extends
  alias_method :extends_and_includes_from, :includes_and_extends_from
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
sugar-high-0.6.3 lib/sugar-high/includes.rb
sugar-high-0.6.2.1 lib/sugar-high/includes.rb
sugar-high-0.6.1 lib/sugar-high/includes.rb
sugar-high-0.6.0 lib/sugar-high/includes.rb
sugar-high-0.5.5 lib/sugar-high/includes.rb
sugar-high-0.5.4 lib/sugar-high/includes.rb
sugar-high-0.5.3 lib/sugar-high/includes.rb
sugar-high-0.5.1 lib/sugar-high/includes.rb
sugar-high-0.5.0 lib/sugar-high/includes.rb
sugar-high-0.4.9.5 lib/sugar-high/includes.rb
sugar-high-0.4.9.3 lib/sugar-high/includes.rb
sugar-high-0.4.9.2 lib/sugar-high/includes.rb
sugar-high-0.4.9.1 lib/sugar-high/includes.rb
sugar-high-0.4.9 lib/sugar-high/includes.rb
sugar-high-0.4.8 lib/sugar-high/includes.rb
sugar-high-0.4.7 lib/sugar-high/includes.rb
sugar-high-0.4.6.4 lib/sugar-high/includes.rb
sugar-high-0.4.6.3 lib/sugar-high/includes.rb
sugar-high-0.4.6.2 lib/sugar-high/includes.rb
sugar-high-0.4.6.1 lib/sugar-high/includes.rb