sinject 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/README.md +23 -22
  4. data/lib/sinject/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4b501138ed0b8872f405861b14cde245114c751
4
- data.tar.gz: d88eebbbfd2396a0ac99b666bedd68ac2ff0697a
3
+ metadata.gz: db6745bbf4a6fd9f3355de4ebdc1b1a8ff9baac2
4
+ data.tar.gz: 5e595fc791ed9ed491df2cc49359cf821641f6ac
5
5
  SHA512:
6
- metadata.gz: 91617b66be38aa50184ce4632e0599245f51b6aa8a53f235bb7f3d53d051f3b8b7a57eafec890fa65cd86848166dd846c78e9d613ed54d8fda5d80b0d27487df
7
- data.tar.gz: d4faa88400fc584775400549212b7bb2b7f868999d831891fe7900f08d3875303389308216cd3efa05b8692a14e617d35a0858db414c216f7b2bf4b418457a8e
6
+ metadata.gz: 88674605b4a9265fa8e2835fc4dd4dadb02be1535feff9ae5f863fcd799563483753f8056505fb7bba2d282e901fab766bb23a08a36100d10b496efcc2f4611b
7
+ data.tar.gz: f7d5be771710b45ba3d3fa6dc5aa9674faf96037a60d4cda3e850572deff3657d71eb6f2d739fcc1255de7330592e5550a7438e12f4a05ecd0dbabf6cde13297
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
- gem 'pry'
data/README.md CHANGED
@@ -54,6 +54,29 @@ Dependencies that require custom initialization can be registered with an initia
54
54
 
55
55
  Dependencies with a custom initialization block must return an object of the registered dependency class type, if an unexpected instance is returned then Sinject will raise a `DependencyInitializeException`.
56
56
 
57
+ **Assigning dependencies**
58
+
59
+ To assign a dependency to an object you need to add the dependency attribute to the class and specify the symbol key that was used to register the dependency with the SinjectContainer:
60
+
61
+ class MySqlCountryRepository
62
+
63
+ dependency :cache_store
64
+
65
+ .....
66
+ end
67
+
68
+ class CountryController < ActionController::Base
69
+
70
+ dependency :country_repository
71
+
72
+ .....
73
+ end
74
+
75
+ Sinject will then inject the registered dependency to that object and it will be accessible via the dependency key:
76
+
77
+ country_controller.country_repository.cache_store
78
+
79
+
57
80
  **Dependency Contracts**
58
81
 
59
82
  Dependency contracts can be defined to validate registered dependencies are valid for the task they are being registered for. *(If you are familiar with other type based languages then you can think of this as a kind of Interface)*
@@ -99,28 +122,6 @@ To load valid dependency groups the following method needs to be called from the
99
122
 
100
123
  container.load_groups
101
124
 
102
- **Assigning dependencies**
103
-
104
- To assign a dependency to an object you need to add the dependency attribute to the class and specify the symbol key that was used to register the dependency with the SinjectContainer:
105
-
106
- class MySqlCountryRepository
107
-
108
- dependency :cache_store
109
-
110
- .....
111
- end
112
-
113
- class CountryController < ActionController::Base
114
-
115
- dependency :country_repository
116
-
117
- .....
118
- end
119
-
120
- Sinject will then inject the registered dependency to that object and it will be accessible via the dependency key:
121
-
122
- country_controller.country_repository.cache_store
123
-
124
125
 
125
126
  ## Development
126
127
 
@@ -1,3 +1,3 @@
1
1
  module Sinject
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughan britton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-12 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler