Sutto-perennial 0.2.3.3 → 0.2.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/perennial/core_ext/misc.rb +28 -0
- data/lib/perennial.rb +1 -1
- metadata +2 -2
@@ -68,6 +68,19 @@ class Module
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
+
def add_extension(name, &blk)
|
72
|
+
item = name.to_s.camelize.to_sym
|
73
|
+
return unless const_defined?(item)
|
74
|
+
target = const_get(item)
|
75
|
+
if target.is_a?(Class)
|
76
|
+
target.class_eval(&blk)
|
77
|
+
elsif target.is_a?(Module)
|
78
|
+
target.module_eval(&blk)
|
79
|
+
else
|
80
|
+
raise "Unable to extend #{target.inspect}"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
71
84
|
def attempt_require(*files)
|
72
85
|
files.each do |file|
|
73
86
|
begin
|
@@ -77,4 +90,19 @@ class Module
|
|
77
90
|
end
|
78
91
|
end
|
79
92
|
|
93
|
+
end
|
94
|
+
|
95
|
+
class Class
|
96
|
+
|
97
|
+
def is(*mixins)
|
98
|
+
ns = Perennial::Manifest.namespace
|
99
|
+
return if ns.blank?
|
100
|
+
mixins.each do |mixin|
|
101
|
+
real_name = mixin.to_s.camelize
|
102
|
+
if ns.const_defined?(real_name)
|
103
|
+
include ns.const_get(real_name)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
80
108
|
end
|
data/lib/perennial.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Sutto-perennial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.3.
|
4
|
+
version: 0.2.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darcy Laycock
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-08 00:00:00 -07:00
|
13
13
|
default_executable: perennial
|
14
14
|
dependencies: []
|
15
15
|
|