pharrell 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +39 -0
- data/pharrell.gemspec +3 -1
- metadata +18 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 02777385b287ad614c0a3c54c0d89ce7635df55b
|
|
4
|
+
data.tar.gz: 2b3a16837a67423708cf8dfc1725d39495e0ebfb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 074cb219edc5df2dcd6e77471457c77c57566d6a9802e19017bfb7bbbeedf9ff36f526feba2bf24c463fe6bb4acbafe96d695387a4913badc1a4949265bba09e
|
|
7
|
+
data.tar.gz: c9f1d5fc8e641f8cd4a90772c7f43b8cec4da3aa89b5103f810c886f6336410bbb98dbce8578cf2b7fea15c4f951cfa9ee378162960e4f2b78b52cc8e66f799a
|
data/README.md
CHANGED
|
@@ -18,6 +18,8 @@ Or, install for your system:
|
|
|
18
18
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
21
|
+
### Basics
|
|
22
|
+
|
|
21
23
|
You can inject dependencies into classes like so:
|
|
22
24
|
|
|
23
25
|
```ruby
|
|
@@ -64,3 +66,40 @@ describe "CurrentTime" do
|
|
|
64
66
|
end
|
|
65
67
|
end
|
|
66
68
|
```
|
|
69
|
+
|
|
70
|
+
### Bindings
|
|
71
|
+
|
|
72
|
+
When building configurations in pharrell you can bind instances to
|
|
73
|
+
produce to classes in three different ways:
|
|
74
|
+
|
|
75
|
+
```ruby
|
|
76
|
+
Pharrell.config(:example) do |config|
|
|
77
|
+
config.bind(Object) { Object.new } # Evaluate and return for each injected Object
|
|
78
|
+
config.bind(Enumerable, Array) # Return a new instance of Array for each injected Enumerable
|
|
79
|
+
config.bind(String, "Hello") # Every injected String will be the same instance of "Hello"
|
|
80
|
+
end
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The last option (every String is "Hello") allows you to
|
|
84
|
+
provides singletons using Pharrell. It's important to note that calling
|
|
85
|
+
`.use_config` will cause the specified configuration to rerun its
|
|
86
|
+
definition block and rebuild all singletons. This is useful in testing
|
|
87
|
+
as you can assert on an object shared between test and real code without
|
|
88
|
+
worrying about resetting or rebuilding it to avoid test pollution.
|
|
89
|
+
|
|
90
|
+
### Extending Configurations
|
|
91
|
+
|
|
92
|
+
You can also extend configurations. This allows you to use all the
|
|
93
|
+
bindings from the original configuration and override bindings you want
|
|
94
|
+
to change. For instance:
|
|
95
|
+
|
|
96
|
+
```ruby
|
|
97
|
+
Pharrell.use_config(:base) do |config|
|
|
98
|
+
config.bind(String, "This string")
|
|
99
|
+
config.bind(Hash, { :key => "value" })
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
Pharrell.use_config(:more, :extend => :base) do |config|
|
|
103
|
+
config.bind(String, "This string instead")
|
|
104
|
+
end
|
|
105
|
+
```
|
data/pharrell.gemspec
CHANGED
|
@@ -3,7 +3,7 @@ $:.unshift lib unless $:.include?(lib)
|
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "pharrell"
|
|
6
|
-
s.version = "0.4.
|
|
6
|
+
s.version = "0.4.2"
|
|
7
7
|
s.platform = Gem::Platform::RUBY
|
|
8
8
|
s.authors = ["Callum Stott"]
|
|
9
9
|
s.email = ["callum@seadowg.com"]
|
|
@@ -12,4 +12,6 @@ Gem::Specification.new do |s|
|
|
|
12
12
|
|
|
13
13
|
s.require_paths = ['lib']
|
|
14
14
|
s.files = `git ls-files`.split("\n")
|
|
15
|
+
|
|
16
|
+
s.add_dependency "matilda-function"
|
|
15
17
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pharrell
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Callum Stott
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
12
|
-
dependencies:
|
|
11
|
+
date: 2013-11-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: matilda-function
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - '>='
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - '>='
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
13
27
|
description:
|
|
14
28
|
email:
|
|
15
29
|
- callum@seadowg.com
|
|
@@ -51,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
51
65
|
version: '0'
|
|
52
66
|
requirements: []
|
|
53
67
|
rubyforge_project:
|
|
54
|
-
rubygems_version: 2.0.
|
|
68
|
+
rubygems_version: 2.0.3
|
|
55
69
|
signing_key:
|
|
56
70
|
specification_version: 4
|
|
57
71
|
summary: I'm a provider gurl.
|