angostura 0.5 → 0.6.0

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: 3cfa706285c534eca74ae45b9326093cdc5a58c1
4
- data.tar.gz: 0ee23d22554018edb0fa34ac87ea6e3974eafe09
3
+ metadata.gz: 88a823832cba57904de7a4ec01ce3ca75a5d4e90
4
+ data.tar.gz: 71d76d3e38436567e1899fa65994da9c4cd26fc0
5
5
  SHA512:
6
- metadata.gz: a4ff5d5d01ab6588f0c6768e55c719ee81cd3f839b5ceaf80178c88bc9eeb37c83bfbfa1d617f61d641a176b711570efa9cc8cefbde79974d8f36a87c1b11a3a
7
- data.tar.gz: cdc24934cee6605f69024189310acda99b4518d3a3beeadc66d85f5e49a96c3c6f3b9680a417816e6721c104a328d8369e503e8a95fe9bd96b35080d04f504b6
6
+ metadata.gz: efc241c78b02ae11f1dc0e45cd254012b3b8d1f4d97395e4a64f7bd1d223f31aea9168085ab2284fbed5abc2cef0cdbcf504d02f5541a3931e83b5caa3d96b32
7
+ data.tar.gz: 3eb0a13d28ce40e96a88b433c45d0b717bef4c895a5214c9a41d10bb29118b06f5ed35a78808f94f9ecde2785a7067bc02cd259d47d9a909de83539a16f346c1
data/lib/angostura.rb CHANGED
@@ -1,5 +1,6 @@
1
- require 'angostura/dependencies'
2
1
  require 'angostura/dependency_error'
2
+ require 'angostura/dependency_type_error'
3
+ require 'angostura/dependencies'
3
4
 
4
5
  module Angostura
5
6
  end
@@ -17,9 +17,14 @@ module Angostura
17
17
 
18
18
  def dependency(*args, **kargs)
19
19
  self.dependencies = args + kargs&.keys
20
- singleton_class.send(:attr_accessor, *dependencies)
20
+ singleton_class.send(:attr_reader, *dependencies)
21
21
 
22
22
  dependencies.each do |dependency|
23
+ define_singleton_method "#{dependency}=" do |value|
24
+ raise Angostura::DependencyTypeError.new(value) if !value.is_a? String
25
+ self.class_eval("@#{dependency} = value")
26
+ end
27
+
23
28
  define_singleton_method "#{dependency}_class" do
24
29
  Object.const_get(self.send(dependency))
25
30
  end
@@ -0,0 +1,7 @@
1
+ module Angostura
2
+ class DependencyTypeError < StandardError
3
+ def initialize(dependency)
4
+ super("Component requires setting a dependency as a stringified class name, you set #{dependency}.")
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Angostura
2
- VERSION = '0.5'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angostura
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - justin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-22 00:00:00.000000000 Z
11
+ date: 2017-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,6 +76,7 @@ files:
76
76
  - lib/angostura.rb
77
77
  - lib/angostura/dependencies.rb
78
78
  - lib/angostura/dependency_error.rb
79
+ - lib/angostura/dependency_type_error.rb
79
80
  - lib/angostura/version.rb
80
81
  homepage: https://github.com/justindoody/angostura
81
82
  licenses: