sugar-high 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
1
+ 0.2.10
@@ -1,26 +1,38 @@
1
1
  require 'active_support/inflector'
2
+ require 'sugar-high/array'
2
3
 
3
4
  class Module
4
- def includes *module_names
5
- module_names.flatten.each do |name|
6
- class_eval %{
7
- include #{name.to_s.camelize}
8
- }
9
- end
10
- end
11
-
12
- def extends *module_names
13
- module_names.flatten.each do |name|
14
- class_eval %{
15
- extend #{name.to_s.camelize}
16
- }
17
- end
18
- end
5
+ [:include, :extend].each do |name|
6
+ plural = name.to_s.pluralize
7
+ class_eval %{
8
+ def #{plural} *module_names
9
+ module_names.to_symbols.each do |name|
10
+ class_eval %{
11
+ #{name} \#{name.to_s.camelize}
12
+ }
13
+ end
14
+ end
19
15
 
16
+ def #{name}_from module_name, *sub_modules
17
+ sub_modules.to_symbols.each do |name|
18
+ class_eval %{
19
+ #{name} \#{module_name.to_s.camelize}::\#{name.to_s.camelize}
20
+ }
21
+ end
22
+ end
23
+ }
24
+ end
25
+
20
26
  def includes_and_extends *module_names
21
27
  includes module_names
22
28
  extends module_names
23
29
  end
24
30
 
31
+ def includes_and_extends_from module_name, *sub_modules
32
+ includes module_name, *sub_modules
33
+ extends module_name, *sub_modules
34
+ end
35
+
25
36
  alias_method :extends_and_includes, :includes_and_extends
37
+ alias_method :extends_and_includes_from, :includes_and_extends_from
26
38
  end
data/sugar-high.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sugar-high}
8
- s.version = "0.2.9"
8
+ s.version = "0.2.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kristian Mandrup"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 9
9
- version: 0.2.9
8
+ - 10
9
+ version: 0.2.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup