pharrell 0.3.0 → 0.4.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: cb4bf66bc2f1c6dc17040e0b81c9bbed25ad9341
4
- data.tar.gz: e363140c7471601cb9ae3b608266bb18abc8c4f6
3
+ metadata.gz: 5be772042e0ae8ae198832f45fc8128e7cca7dde
4
+ data.tar.gz: 8a56e5c78cb524571d50147119639418da0d4ebb
5
5
  SHA512:
6
- metadata.gz: 95ee5a87bbad1cceab0c63b0e7ab4cb9597ba42d9230b4a948eb111d4252323f7c628511c9e69051436f07901c01809a5880923bd08529c1ee15c71312789dc7
7
- data.tar.gz: 78b2c79462d36dd6961f07f9df22f06367f1258069016d839446d16e9e68a3e309941933f0edee60e7a9b19a82550c2d8248b35a3a10ce6caf4c051844e0b7c8
6
+ metadata.gz: 38097aee346ff692ca497f28e4b27851fee3eef71d6dc83abac444ff15eb8fee103d27250901fe7ac786ef15c7485fa50899cdf33e83bbd4d2854114ca9a32e2
7
+ data.tar.gz: 9bae23e940c64d3bc25ece7867d4a2bca22a88c5df0fbc6959ad4481f54c9c8ba64e83ac3f6d26ca2db12284ac823eca1b21314e9be766f99b6720e11c2a2f3b
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'matilda-function'
4
+
3
5
  group :test do
4
6
  gem 'rake'
5
7
  end
data/Gemfile.lock CHANGED
@@ -1,10 +1,12 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
+ matilda-function (0.3.0)
4
5
  rake (10.0.3)
5
6
 
6
7
  PLATFORMS
7
8
  ruby
8
9
 
9
10
  DEPENDENCIES
11
+ matilda-function
10
12
  rake
@@ -1,3 +1,5 @@
1
+ require 'matilda-function'
2
+
1
3
  module Pharrell
2
4
  class Config
3
5
  def initialize(definition)
@@ -15,6 +17,10 @@ module Pharrell
15
17
  }.bindings
16
18
  end
17
19
 
20
+ def extend(definition)
21
+ Config.new(@definition + definition)
22
+ end
23
+
18
24
  private
19
25
 
20
26
  class Binder
data/lib/pharrell.rb CHANGED
@@ -5,8 +5,12 @@ module Pharrell
5
5
  @@configs = {}
6
6
  @@config = nil
7
7
 
8
- def self.config(name, &blk)
9
- @@configs[name] = Config.new(blk)
8
+ def self.config(name, opts = {}, &blk)
9
+ if opts[:extends]
10
+ @@configs[name] = @@configs[opts[:extends]].extend(blk)
11
+ else
12
+ @@configs[name] = Config.new(blk)
13
+ end
10
14
  end
11
15
 
12
16
  def self.use_config(name)
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.3.0"
6
+ s.version = "0.4.0"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Callum Stott"]
9
9
  s.email = ["callum@seadowg.com"]
@@ -18,6 +18,21 @@ describe "Pharrell" do
18
18
  Pharrell.use_config(:main)
19
19
  assert_equal(Pharrell.instance_for(Time), Time.at(0))
20
20
  end
21
+
22
+ it "allows extensions of a previous config" do
23
+ Pharrell.config(:main) do |c|
24
+ c.bind(Object, "Object")
25
+ c.bind(String, "Hello")
26
+ end
27
+
28
+ Pharrell.config(:test, :extends => :main) do |c|
29
+ c.bind(String, "Hello, Test")
30
+ end
31
+
32
+ Pharrell.use_config(:test)
33
+ assert_equal(Pharrell.instance_for(Object), "Object")
34
+ assert_equal(Pharrell.instance_for(String), "Hello, Test")
35
+ end
21
36
  end
22
37
 
23
38
  describe ".rebuild!" do
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.3.0
4
+ version: 0.4.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-08-07 00:00:00.000000000 Z
11
+ date: 2013-08-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: