handlebars 0.3.2beta2 → 0.3.2beta3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/handlebars/context.rb +18 -0
- data/lib/handlebars/version.rb +1 -1
- data/spec/handlebars_spec.rb +7 -0
- metadata +3 -3
data/lib/handlebars/context.rb
CHANGED
@@ -43,8 +43,26 @@ module Handlebars
|
|
43
43
|
@js.require('handlebars/base')
|
44
44
|
end
|
45
45
|
|
46
|
+
def runtime
|
47
|
+
@js.runtime
|
48
|
+
end
|
49
|
+
|
50
|
+
def []=(key, value)
|
51
|
+
data[key] = value
|
52
|
+
end
|
53
|
+
|
54
|
+
def [](key)
|
55
|
+
data[key]
|
56
|
+
end
|
57
|
+
|
46
58
|
class << self
|
47
59
|
attr_accessor :current
|
48
60
|
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def data
|
65
|
+
handlebars[:_rubydata] ||= @js.new_object
|
66
|
+
end
|
49
67
|
end
|
50
68
|
end
|
data/lib/handlebars/version.rb
CHANGED
data/spec/handlebars_spec.rb
CHANGED
@@ -72,6 +72,13 @@ describe(Handlebars::Context) do
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
describe "context specific data" do
|
76
|
+
before {subject['foo'] = 'bar'}
|
77
|
+
it 'can be get and set' do
|
78
|
+
subject['foo'].should eql 'bar'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
75
82
|
def compile(*args)
|
76
83
|
subject.compile(*args)
|
77
84
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: handlebars
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2beta3
|
5
5
|
prerelease: 5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: therubyracer
|
@@ -143,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
segments:
|
145
145
|
- 0
|
146
|
-
hash:
|
146
|
+
hash: 671216264178140519
|
147
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
148
|
none: false
|
149
149
|
requirements:
|