ruby-handlebars 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 151c26376bf8460ee2826d37725ab7cec3f75676
4
- data.tar.gz: 2fa8d9952bec2bc231263ad18b4e9b3daabdeeea
3
+ metadata.gz: 9e63c4f5d37f79ac23d9c970942bee195d95e14a
4
+ data.tar.gz: 4cf5f61a9e046de6c3630d792a32f9636bfede90
5
5
  SHA512:
6
- metadata.gz: e322d2c6a44586ed7e28cd53176602be2b8b86b44a06f710adfd962a7ed50ae5a39fccecb8ee083850ef82be71e3a09a5a3b814e8f28880736f2f12e04c0283e
7
- data.tar.gz: 0f46a77dce2f30aef353880f8feee1a81fef3d8dda36047e328fcdc24667882d8d32b0d6c0773fe4b2ac3f62d4d2650feeba70b800fa8bd72234c984ee80f56d
6
+ metadata.gz: 7fde4e2ae941f01c7c43b2aaf2ebf4f508f603a0dc2797cb77a8e2e35a96309c14fddf4902589009ebdc0396e51b3b5c96798054a60f7f98e0399aa592a53ed1
7
+ data.tar.gz: 9b5592a196121201380ea33588ab8321e6009097ef34aba8b77548081f3b15dbdc8d1aeb573a58a32e8e1e8bbbdc9cca9f02dffe142d18750ed6d10b3dc53ac1
@@ -38,8 +38,12 @@ module Handlebars
38
38
  end
39
39
 
40
40
  private
41
+
42
+ PARSER = Parser.new
43
+ TRANSFORM = Transform.new
44
+
41
45
  def template_to_ast(content)
42
- Transform.new.apply(Parser.new.parse(content))
46
+ TRANSFORM.apply(PARSER.parse(content))
43
47
  end
44
48
 
45
49
  def register_default_helpers
@@ -79,4 +83,4 @@ module Handlebars
79
83
  end
80
84
  end
81
85
  end
82
- end
86
+ end
@@ -1,7 +1,7 @@
1
1
  module Handlebars
2
2
  module Context
3
3
  def get(path)
4
- items = path.split('.')
4
+ items = path.split('.'.freeze)
5
5
 
6
6
  current = @data
7
7
  until items.empty?
@@ -21,7 +21,7 @@ module Handlebars
21
21
  sym_attr = attribute.to_sym
22
22
  str_attr = attribute.to_s
23
23
 
24
- if item.respond_to?('[]')
24
+ if item.respond_to?(:[])
25
25
  if item.has_key?(sym_attr)
26
26
  return item[sym_attr]
27
27
  elsif item.has_key?(str_attr)
@@ -38,4 +38,4 @@ module Handlebars
38
38
  end
39
39
  end
40
40
  end
41
- end
41
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-handlebars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Pretre
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-06 00:00:00.000000000 Z
12
+ date: 2015-10-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parslet