bold 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Bold
2
2
 
3
- TODO: Write a gem description
3
+ Bold objects say what they need and collaborate with trust
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Bold::VERSION
9
9
  spec.authors = ["Abhi Hiremagalur"]
10
10
  spec.email = ["abhijit@hiremaga.com"]
11
- spec.description = %q{Bold objects say they need and collaborate with trust}
12
- spec.summary = %q{Bold objects say they need and collaborate with trust}
11
+ spec.description = %q{Bold objects say what they need and collaborate with trust}
12
+ spec.summary = %q{Bold objects say what they need and collaborate with trust}
13
13
  spec.homepage = "http://github.com/hiremaga/bold"
14
14
  spec.license = "MIT"
15
15
 
@@ -1,6 +1,8 @@
1
1
  require "bold/version"
2
2
 
3
3
  module Bold
4
+ autoload :Base, 'bold/base'
5
+
4
6
  @suppliers = {}
5
7
 
6
8
  def self.included(klass)
@@ -15,13 +17,11 @@ module Bold
15
17
  @suppliers[need].call
16
18
  end
17
19
 
18
- def initialize(attributes={})
19
- @supplies = attributes.delete(:supplies) || {}
20
- end
21
-
22
20
  module ClassMethods
23
21
  def needs(need)
22
+
24
23
  define_method(need) do
24
+ @supplies ||= {}
25
25
  @supplies[need] ||= Bold.supply(need)
26
26
  end
27
27
  end
@@ -0,0 +1,9 @@
1
+ module Bold
2
+ class Base
3
+ include Bold
4
+
5
+ def initialize(attributes={})
6
+ @supplies = attributes.delete(:supplies)
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Bold
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -9,12 +9,6 @@ describe Bold do
9
9
  include Bold
10
10
 
11
11
  needs :piano
12
- attr_reader :attributes
13
-
14
- def initialize(attributes={})
15
- super
16
- @attributes = attributes
17
- end
18
12
  end
19
13
 
20
14
  subject do
@@ -23,11 +17,23 @@ describe Bold do
23
17
 
24
18
  its(:piano) { should be_a(Piano) }
25
19
 
26
- context "when it is supplied Bach's lautenwerck" do
27
- let(:lautenwerck) { double }
20
+ context "when supplied Bach's lautenwerck" do
21
+ class Smith < Bold::Base
22
+ needs :piano
23
+ attr_reader :attributes
24
+
25
+ attr_reader :attributes
26
+
27
+ def initialize(attributes={})
28
+ super
29
+ @attributes = attributes
30
+ end
31
+ end
32
+
33
+ let(:lautenwerck) { "Bach's lautenwerck" }
28
34
 
29
35
  subject do
30
- Bob.new(supplies: {
36
+ Smith.new(supplies: {
31
37
  piano: lautenwerck
32
38
  })
33
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -59,7 +59,7 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
- description: Bold objects say they need and collaborate with trust
62
+ description: Bold objects say what they need and collaborate with trust
63
63
  email:
64
64
  - abhijit@hiremaga.com
65
65
  executables: []
@@ -75,6 +75,7 @@ files:
75
75
  - Rakefile
76
76
  - bold.gemspec
77
77
  - lib/bold.rb
78
+ - lib/bold/base.rb
78
79
  - lib/bold/version.rb
79
80
  - spec/bold_spec.rb
80
81
  - spec/spec_helper.rb
@@ -93,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
94
  version: '0'
94
95
  segments:
95
96
  - 0
96
- hash: -2640617838403457670
97
+ hash: -1985948657607670539
97
98
  required_rubygems_version: !ruby/object:Gem::Requirement
98
99
  none: false
99
100
  requirements:
@@ -102,13 +103,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
103
  version: '0'
103
104
  segments:
104
105
  - 0
105
- hash: -2640617838403457670
106
+ hash: -1985948657607670539
106
107
  requirements: []
107
108
  rubyforge_project:
108
109
  rubygems_version: 1.8.25
109
110
  signing_key:
110
111
  specification_version: 3
111
- summary: Bold objects say they need and collaborate with trust
112
+ summary: Bold objects say what they need and collaborate with trust
112
113
  test_files:
113
114
  - spec/bold_spec.rb
114
115
  - spec/spec_helper.rb