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 +1 -1
- data/lib/sugar-high/includes.rb +27 -15
- data/sugar-high.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.10
|
data/lib/sugar-high/includes.rb
CHANGED
@@ -1,26 +1,38 @@
|
|
1
1
|
require 'active_support/inflector'
|
2
|
+
require 'sugar-high/array'
|
2
3
|
|
3
4
|
class Module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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