angostura 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/angostura/dependencies.rb +5 -20
- data/lib/angostura/version.rb +1 -1
- data/lib/angostura.rb +0 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cfa706285c534eca74ae45b9326093cdc5a58c1
|
4
|
+
data.tar.gz: 0ee23d22554018edb0fa34ac87ea6e3974eafe09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4ff5d5d01ab6588f0c6768e55c719ee81cd3f839b5ceaf80178c88bc9eeb37c83bfbfa1d617f61d641a176b711570efa9cc8cefbde79974d8f36a87c1b11a3a
|
7
|
+
data.tar.gz: cdc24934cee6605f69024189310acda99b4518d3a3beeadc66d85f5e49a96c3c6f3b9680a417816e6721c104a328d8369e503e8a95fe9bd96b35080d04f504b6
|
@@ -5,43 +5,28 @@ module Angostura
|
|
5
5
|
end
|
6
6
|
|
7
7
|
module ClassMethods
|
8
|
-
|
9
|
-
@@dependencies
|
10
|
-
end
|
11
|
-
|
12
|
-
def dependencies=(value)
|
13
|
-
@@dependencies = value
|
14
|
-
end
|
8
|
+
attr_accessor :dependencies
|
15
9
|
|
16
10
|
def setup
|
17
11
|
yield self
|
18
12
|
|
19
13
|
dependencies.each do |dependency|
|
20
|
-
raise Angostura::DependencyError.new(dependency) if
|
14
|
+
raise Angostura::DependencyError.new(dependency) if send(dependency).nil?
|
21
15
|
end
|
22
16
|
end
|
23
17
|
|
24
18
|
def dependency(*args, **kargs)
|
25
19
|
self.dependencies = args + kargs&.keys
|
20
|
+
singleton_class.send(:attr_accessor, *dependencies)
|
26
21
|
|
27
22
|
dependencies.each do |dependency|
|
28
|
-
|
29
|
-
|
30
|
-
self.define_singleton_method "#{dependency}" do
|
31
|
-
class_eval("@@#{dependency}")
|
32
|
-
end
|
33
|
-
|
34
|
-
self.define_singleton_method "#{dependency}=" do |value|
|
35
|
-
class_eval("@@#{dependency} = '#{value}'")
|
36
|
-
end
|
37
|
-
|
38
|
-
self.define_singleton_method "#{dependency}_class" do
|
23
|
+
define_singleton_method "#{dependency}_class" do
|
39
24
|
Object.const_get(self.send(dependency))
|
40
25
|
end
|
41
26
|
end
|
42
27
|
|
43
28
|
kargs.each do |key, default_value|
|
44
|
-
|
29
|
+
send("#{key}=", default_value)
|
45
30
|
end
|
46
31
|
end
|
47
32
|
end
|
data/lib/angostura/version.rb
CHANGED
data/lib/angostura.rb
CHANGED