content_for_once 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/content_for_once/helpers.rb +4 -4
- data/lib/content_for_once/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 309f7bd11fee9cf63a9b9440c50744ce8da5bca8
|
4
|
+
data.tar.gz: 697ca1307a07712790596c8efbb65adc6b492195
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2d84f51fafbf26ccb80569861aa6316da64e2617c0a3e630cf8c09081bff58b293416e2f1ca0b09cc757cd25ff2b93da23060841b510a3f011123da9363194f
|
7
|
+
data.tar.gz: 063d7cf4a99b688eb449e0862c44ca2081dfc0891cee298d19420ec587db40be78091ab7cf9857e002303913c025dccce60c68c74d44410dbf3e6ed7a176a203
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module ContentForOnce
|
2
2
|
module Helpers
|
3
3
|
def content_for_once(name, &block)
|
4
|
-
@
|
4
|
+
@content_for_once ||= Hash.new {|h, k| h[k] = '' }
|
5
5
|
name = name.to_sym
|
6
6
|
|
7
|
-
@
|
8
|
-
@
|
7
|
+
@content_for_once[name].concat(capture(&block)) if capture(&block).present?
|
8
|
+
@content_for_once[name] = Nokogiri::HTML.fragment(@content_for_once[name]).children.
|
9
9
|
map(&:to_s).select(&:present?).map {|e| e.gsub(/>\n/, '>') }.uniq.join("\n")
|
10
10
|
|
11
|
-
@
|
11
|
+
@content_for_once.each do |name, content|
|
12
12
|
# ref: https://github.com/rails/rails/blob/master/actionview/lib/action_view/helpers/capture_helper.rb#L149
|
13
13
|
_content = @view_flow.get(name).presence || ''
|
14
14
|
_content.concat(content.html_safe)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: content_for_once
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryusuke Sekiguchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.
|
138
|
+
rubygems_version: 2.5.1
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Embed the HTML tags just only once
|