bldr 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -150,6 +150,7 @@ module Bldr
150
150
  merge_result!(arg, current_object.send(arg))
151
151
  end
152
152
  end
153
+ self
153
154
  end
154
155
 
155
156
  def attribute(*args,&block)
@@ -157,7 +158,6 @@ module Bldr
157
158
  raise(ArgumentError, "You may only pass one argument to #attribute when using the block syntax.") if args.size > 1
158
159
  raise(ArgumentError, "You cannot use a block of arity > 0 if current_object is not present.") if block.arity > 0 and current_object.nil?
159
160
  merge_result!(args.first, (block.arity == 1) ? block.call(current_object) : current_object.instance_eval(&block))
160
- self
161
161
  else
162
162
  case args.size
163
163
  when 1 # inferred object
@@ -173,6 +173,7 @@ module Bldr
173
173
  raise(ArgumentError, "You cannot pass more than two arguments to #attribute.")
174
174
  end
175
175
  end
176
+ self
176
177
  end
177
178
 
178
179
  # Render a template inline within a view
@@ -203,7 +204,7 @@ module Bldr
203
204
  def find_template(template)
204
205
  path = []
205
206
  path << views if views
206
- template += ".json.bldr" unless template =~ /\.json\.bldr$/
207
+ template += ".json.bldr" unless template =~ /\.bldr$/
207
208
  path << template
208
209
  File.join(*path)
209
210
  end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Bldr
3
- VERSION = '0.5.4'
3
+ VERSION = '0.5.5'
4
4
  end
@@ -6,6 +6,17 @@ ERROR_MESSAGES = { :attribute_lambda_one_argument => "You may only
6
6
  :attribute_inferred_missing_arity_too_large => "You cannot use a block of arity > 0 if current_object is not present.",
7
7
  :attributes_inferred_missing => "No current_object to apply #attributes to." }
8
8
 
9
+ describe "Node#attributes" do
10
+ let(:person) {
11
+ Person.new('john', 25)
12
+ }
13
+ let(:node) { Bldr::Node.new(person) }
14
+
15
+ it "returns stuff" do
16
+ node.attribute(:age).should == node
17
+ end
18
+ end
19
+
9
20
  describe "Node#object" do
10
21
 
11
22
  context "a zero arg root object node" do
@@ -629,4 +640,4 @@ describe "Node#locals" do
629
640
  subject { node.locals }
630
641
 
631
642
  it { should == {:key => 'val'} }
632
- end
643
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bldr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-25 00:00:00.000000000 Z
12
+ date: 2012-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
16
- requirement: &70282606563340 !ruby/object:Gem::Requirement
16
+ requirement: &70314605956260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70282606563340
24
+ version_requirements: *70314605956260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json_pure
27
- requirement: &70282606562140 !ruby/object:Gem::Requirement
27
+ requirement: &70314605955840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70282606562140
35
+ version_requirements: *70314605955840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sinatra
38
- requirement: &70282606560360 !ruby/object:Gem::Requirement
38
+ requirement: &70314605955340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.2.6
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70282606560360
46
+ version_requirements: *70314605955340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: tilt
49
- requirement: &70282606558200 !ruby/object:Gem::Requirement
49
+ requirement: &70314605954840 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.3.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70282606558200
57
+ version_requirements: *70314605954840
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: yajl-ruby
60
- requirement: &70282606557500 !ruby/object:Gem::Requirement
60
+ requirement: &70314605954380 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '1.0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70282606557500
68
+ version_requirements: *70314605954380
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: actionpack
71
- requirement: &70282606573160 !ruby/object:Gem::Requirement
71
+ requirement: &70314605953920 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 3.0.7
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70282606573160
79
+ version_requirements: *70314605953920
80
80
  description: Provides a simple and intuitive templating DSL for serializing objects
81
81
  to JSON.
82
82
  email: