pharrell 0.0.2 → 0.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 763ce3991d29d013f6bbc5ee6f9820c831c53949
4
- data.tar.gz: f30fde1f5b699bb7e21f2fbbaa6709ec180ab665
3
+ metadata.gz: 41a3076d9bda63ccd3f36694165401bf37ef1578
4
+ data.tar.gz: d880e8047bffe68e8cbd2422448bf008e64657ca
5
5
  SHA512:
6
- metadata.gz: fefa0920b6ca856752d56bd79e0cdec9f896f242430e92761ee143a5f9fe886151d9074a1ddf9f41c36eedef4cc97ccbba58fdfeae255d2f1e0e3b20289e4249
7
- data.tar.gz: 0cba93d7d3e8cb23232805888f546815b25130c7dcf1622f656b814376e98b13eab5f61efda89e6208a466c66582d5d8a29654d502d35f50fe1698f96163d483
6
+ metadata.gz: 7f28a10fa1b917c8d46ecf4d656d3d257858f39dff0fbe7f658fb95d036e984eff6a7cb9f420cd194f117740d4f8d14bbebc34d75fb89fd5b0c006c0589dcf32
7
+ data.tar.gz: abb638b2c1453c0d411d829ac8a3165046dc743187ecd402959e000b49b5206bbc8ee991ac963834d85834683b7de7ab9011b62a8ebc3ae09bb5bd3a9f035f2e
data/README.md CHANGED
@@ -1 +1,7 @@
1
+ # Pharrell
2
+
3
+ ![Pharrell](media/pharrell.jpg)
4
+
5
+ ## Description
6
+
1
7
  I'm a provider gurl.
@@ -1,3 +1,6 @@
1
+ require 'pharrell/config'
2
+ require 'pharrell/injectible'
3
+
1
4
  module Pharrell
2
5
  @@configs = {}
3
6
  @@config = nil
@@ -14,24 +17,4 @@ module Pharrell
14
17
  def self.use_config(name)
15
18
  @@config = name
16
19
  end
17
-
18
- class Config
19
- def initialize
20
- @map = {}
21
- end
22
-
23
- def bind(klass, instance_or_class)
24
- @map[klass] = instance_or_class
25
- end
26
-
27
- def instance_for(klass)
28
- instance_or_class = @map[klass]
29
-
30
- if (instance_or_class.is_a? Class)
31
- instance_or_class.new
32
- else
33
- instance_or_class
34
- end
35
- end
36
- end
37
20
  end
@@ -0,0 +1,22 @@
1
+ module Pharrell
2
+ class Config
3
+ def initialize
4
+ @map = {}
5
+ end
6
+
7
+ def bind(klass, instance_or_class)
8
+ @map[klass] = instance_or_class
9
+ end
10
+
11
+ def instance_for(klass)
12
+ instance_or_class = @map[klass]
13
+
14
+ if (instance_or_class.is_a? Class)
15
+ instance_or_class.new
16
+ else
17
+ instance_or_class
18
+ end
19
+ end
20
+ end
21
+ end
22
+
@@ -0,0 +1,15 @@
1
+ module Pharrell
2
+ module Injectible
3
+ def self.included(base)
4
+ base.extend(ClassMethods)
5
+ end
6
+
7
+ module ClassMethods
8
+ def inject(name, klass)
9
+ define_method(name) do
10
+ Pharrell.instance_for(klass)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
Binary file
@@ -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.0.2"
6
+ s.version = "0.1.0"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Callum Stott"]
9
9
  s.email = ["callum@seadowg.com"]
@@ -0,0 +1,19 @@
1
+ require 'minitest/autorun'
2
+ require 'pharrell'
3
+
4
+ describe "Injectible" do
5
+ describe ".inject" do
6
+ it "defines a method to retrieve that class from Pharrell" do
7
+ Pharrell.config(:base) { |c| c.bind(String, "Injected") }
8
+ Pharrell.use_config(:base)
9
+
10
+ klass = Class.new {
11
+ include Pharrell::Injectible
12
+
13
+ inject :string, String
14
+ }
15
+
16
+ assert_equal(klass.new.send(:string), "Injected")
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pharrell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
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-07-31 00:00:00.000000000 Z
11
+ date: 2013-08-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -24,8 +24,12 @@ files:
24
24
  - README.md
25
25
  - Rakefile
26
26
  - lib/pharrell.rb
27
+ - lib/pharrell/config.rb
28
+ - lib/pharrell/injectible.rb
29
+ - media/pharrell.jpg
27
30
  - pharrell.gemspec
28
31
  - spec/config_spec.rb
32
+ - spec/injectible_spec.rb
29
33
  - spec/pharrell_spec.rb
30
34
  homepage:
31
35
  licenses: