Sha256: f2399c85c136e635f65fb61752e52b60b1316d3ced441464e49b6deca041321c

Contents?: true

Size: 523 Bytes

Versions: 9

Compression:

Stored size: 523 Bytes

Contents

require 'active_support/inflector'

class Module
  def includes *module_names
    module_names.flatten.each do |name|
      class_eval %{
        include #{name.to_s.camelize}
      }    
    end
  end 

  def extends *module_names
    module_names.flatten.each do |name|
      class_eval %{
        extend #{name.to_s.camelize}
      }    
    end
  end 

  def includes_and_extends *module_names
    includes module_names
    extends module_names
  end    

  alias_method :extends_and_includes, :includes_and_extends
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sugar-high-0.2.9 lib/sugar-high/includes.rb
sugar-high-0.2.8 lib/sugar-high/includes.rb
sugar-high-0.2.7 lib/sugar-high/includes.rb
sugar-high-0.2.6 lib/sugar-high/includes.rb
sugar-high-0.2.5 lib/sugar-high/includes.rb
sugar-high-0.2.4 lib/sugar-high/includes.rb
sugar-high-0.2.2 lib/sugar-high/includes.rb
sugar-high-0.2.1 lib/sugar-high/includes.rb
sugar-high-0.2.0 lib/sugar-high/includes.rb