dimples 1.1.3 → 1.2

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: dd2d51dbcbd0c10c03542661f809574871431fba
4
- data.tar.gz: ee382f7f2b50192068d97de6d9610ecbae179f35
3
+ metadata.gz: d4908e2152e8b62a29f3fdc22f75a3e5d6bc5f19
4
+ data.tar.gz: 0561a17cd5b12638bd61ae94af722cbc2b198706
5
5
  SHA512:
6
- metadata.gz: c13dd73aec1705d44b4fcbe166ed503f9574912a36e70efc30dfd46831156286ca36f07036d7f08bce4209341bec2d2b0f2b7abafb204617dfe26b2027f3358a
7
- data.tar.gz: f5b69ede0e4303853b5e6f5ac759ce7e688573e7244414d2b1e83af8f80e6383c322a3923ca8c85ce8af1c71efef1dbc11dbc8c92b4f2621bb4a4d03ece71143
6
+ metadata.gz: fb93e7a063f1ece6224877251b9b132e5ef349221b81a42bceae3642b2c9ac612301976979aa88ebeb00416d54d80191fada37df313cf70b4dfa383ceb08adec
7
+ data.tar.gz: f385a6d339a48e1ef2d63598111d39ce3ae737a7bbd87f5a00c371422326ccc60775cb89ec7f60d372cc986eafcca1e0a089598b922ebeee6840c035dfdfc692
@@ -27,10 +27,6 @@ module Dimples
27
27
  @extension = @site.config['file_extensions']['pages']
28
28
  end
29
29
 
30
- def type
31
- :page
32
- end
33
-
34
30
  def contents
35
31
  @contents
36
32
  end
@@ -41,10 +41,6 @@ module Dimples
41
41
  @day = @date.strftime('%d')
42
42
  end
43
43
 
44
- def type
45
- :post
46
- end
47
-
48
44
  def contents
49
45
  @contents
50
46
  end
@@ -14,8 +14,16 @@ module Dimples
14
14
  end
15
15
 
16
16
  def render(context = {}, body = nil, use_layout = true)
17
+ class_name = self.class.name.split('::').last.downcase.to_sym
18
+
17
19
  context[:site] = @site unless context[:site]
18
- context[:this] = self unless context[:this]
20
+ context[class_name] = self unless context[class_name]
21
+
22
+ scope = Object.new
23
+
24
+ context.each_pair do |key, value|
25
+ scope.instance_variable_set("@#{key}".to_sym, value)
26
+ end
19
27
 
20
28
  proc = Proc.new { |template| contents() }
21
29
 
@@ -27,15 +35,15 @@ module Dimples
27
35
  else
28
36
  Tilt::StringTemplate.new(&proc)
29
37
  end
30
-
38
+
31
39
  begin
32
- output = renderer.render(nil, context) { body }.strip
40
+ output = renderer.render(scope) { body }.strip
33
41
  @rendered_contents = output
34
42
  rescue RuntimeError, TypeError, NoMethodError, SyntaxError => e
35
43
  problem_file = if @path
36
44
  @path.gsub(@site.source_paths[:root], '')
37
45
  else
38
- "dynamic #{type}"
46
+ "dynamic #{self.class}"
39
47
  end
40
48
 
41
49
  raise "Failed to render #{problem_file} - #{e}"
@@ -16,9 +16,5 @@ module Dimples
16
16
 
17
17
  @contents = read_with_yaml(path)
18
18
  end
19
-
20
- def type
21
- :template
22
- end
23
19
  end
24
20
  end
@@ -1,3 +1,3 @@
1
1
  module Dimples
2
- VERSION = "1.1.3"
2
+ VERSION = "1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dimples
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bogan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-03 00:00:00.000000000 Z
11
+ date: 2015-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt