angostura 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 343206419c4cba3064a57fc66b2d599e90570104
4
- data.tar.gz: a1202151edae394424074bd0d241bea27957d844
3
+ metadata.gz: 3cfa706285c534eca74ae45b9326093cdc5a58c1
4
+ data.tar.gz: 0ee23d22554018edb0fa34ac87ea6e3974eafe09
5
5
  SHA512:
6
- metadata.gz: e572ec36f38f583089cf00f284ce0c34e1ae97694d7d3e88d9a430d805a6e342843b59a4f90f4792b2ee42b0e055d31131d5c72dba6e39e495ea14c9a1126ac9
7
- data.tar.gz: 7f838bd16ca8a9a75af7b7a6542dca124533479209361144879a05db05678054c5b0d88c39c7462a979e66a8f256ce47a8d2c708c9a8384d3ad2d307dae8dac2
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
- def dependencies
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 self.send(dependency).nil?
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
- class_eval("@@#{dependency} = nil")
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
- self.send("#{key}=", default_value)
29
+ send("#{key}=", default_value)
45
30
  end
46
31
  end
47
32
  end
@@ -1,3 +1,3 @@
1
1
  module Angostura
2
- VERSION = '0.4'
2
+ VERSION = '0.5'
3
3
  end
data/lib/angostura.rb CHANGED
@@ -1,6 +1,3 @@
1
- require 'active_support/core_ext/module'
2
- require 'active_support/concern'
3
-
4
1
  require 'angostura/dependencies'
5
2
  require 'angostura/dependency_error'
6
3
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angostura
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - justin