actionview-pathfinder 0.0.2 → 0.1.0

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: 509af212110e60dbf0d225b09953461daeb089eb
4
- data.tar.gz: c6d69ab8e0d52ecc453e56b6f128a078284cb3ca
3
+ metadata.gz: dc0f9b4f01f00344f22a93fb41e1eca695ec4ded
4
+ data.tar.gz: e8613dfddf95f606f14e1fae5f4593381de25311
5
5
  SHA512:
6
- metadata.gz: ffe324193c20e99441b93addcf507193ea5ef2bac139c538647c98a86577758f44a6f586005ef3d22cca0ba2c7dbece1fc5122c2b76b9d8328ce7c03524f50e4
7
- data.tar.gz: d59f3874afe21083730f3d794f73388cef4e804402faaad18ec528d8eb7f6bad4fc7aae2a348dc11edf8344a1d2bad3a405124d583f538220a51e80e77147ddb
6
+ metadata.gz: 84198882c9f212e2bbac621eea44d91cf5e27efaf728d14bbede487f4b9ed05400d749f9f1a069e6eb9e70f68393611f5fe994138037352b7e4669c17be703d4
7
+ data.tar.gz: 83e4a24d45289af625e6fde47251d2aa77afd1cf149cc4ff0ebfb5d9c2a31bf85eb8e40b8e028d6b9e41057d1b2e9b0b7c5c6fc08844007f7abdfb9546bdfa39
@@ -1,8 +1,9 @@
1
1
  require "actionview/pathfinder/version"
2
2
  require "actionview/pathfinder/template"
3
+ require "actionview/pathfinder/partial_renderer"
3
4
 
4
5
  module ActionView
5
6
  module Pathfinder
6
- ActionView::Template.send(:prepend, Pathfinder::Template)
7
+ ActionView::PartialRenderer.send(:prepend, Pathfinder::PartialRenderer)
7
8
  end
8
9
  end
@@ -0,0 +1,12 @@
1
+ module ActionView
2
+ module Pathfinder
3
+ module PartialRenderer
4
+ private
5
+
6
+ def find_template(path, locals)
7
+ template = Pathfinder::Template.new(super)
8
+ template
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,23 +1,38 @@
1
1
  module ActionView
2
2
  module Pathfinder
3
- module Template
3
+ class Template < SimpleDelegator
4
+
5
+ def initialize(template)
6
+ super
7
+ @template = template
8
+ end
4
9
 
5
10
  # adds an html comment at the beginning and end of each template,
6
11
  # when rendering, that contains the path to that view file.
7
12
  #
8
13
  def render(view, locals, buffer=nil, &block)
9
- path = @virtual_path.to_s
10
- @source = [html_comment(path), source, html_comment("end of #{path}")].join('')
14
+ @template.instance_variable_set(:'@source', wrapped_source)
15
+
11
16
  super(view, locals, buffer, &block)
12
17
  end
13
18
 
14
19
  private
15
20
 
21
+ def wrapped_source
22
+ path = virtual_path.to_s
23
+
24
+ [
25
+ html_comment(path),
26
+ source,
27
+ html_comment("end of #{path}")
28
+ ].join('')
29
+ end
30
+
16
31
  def html_comment(text)
17
32
  return '' unless formats.include?(:html)
18
33
 
19
34
  if handler_type == 'haml'
20
- ["/", text, "\n\n"].join('')
35
+ ["/ ", text, "\n\n"].join('')
21
36
  else
22
37
  ["\n<!-- ", text, " -->\n"].join('')
23
38
  end
@@ -1,5 +1,5 @@
1
1
  module Actionview
2
2
  module Pathfinder
3
- VERSION = "0.0.2"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview-pathfinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Duffy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-14 00:00:00.000000000 Z
11
+ date: 2015-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -66,6 +66,7 @@ files:
66
66
  - Rakefile
67
67
  - actionview-pathfinder.gemspec
68
68
  - lib/actionview/pathfinder.rb
69
+ - lib/actionview/pathfinder/partial_renderer.rb
69
70
  - lib/actionview/pathfinder/template.rb
70
71
  - lib/actionview/pathfinder/version.rb
71
72
  homepage: http://github.com/weblinc/actionview-pathfinder