htmlrender 0.0.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 +15 -0
- data/lib/htmlrender.rb +43 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
!binary "U0hBMQ==":
|
|
3
|
+
metadata.gz: !binary |-
|
|
4
|
+
ZjM2YTA2YjM2YjdiNGI4OGJmYjEzNGJmMzcxNTBhOTcyZDQ4N2U2ZQ==
|
|
5
|
+
data.tar.gz: !binary |-
|
|
6
|
+
NTNjMzYxNTYwMWM4YzZmNDQ4ZDFjOTRkYjVhNmM0ZjU5NTM4ZWM4Mw==
|
|
7
|
+
SHA512:
|
|
8
|
+
metadata.gz: !binary |-
|
|
9
|
+
MmYyZTFmZjU5NzBhYjE0MmFhZTA3MWEwM2FjNjg1YjkwYjEzOWU5OGY5ZDUz
|
|
10
|
+
ZjQ3YmFjNzhhMDViZjBmMGE5NzZjMWM0ZDgyMzQ1YmUxYjVjNzhjMjVkZWE1
|
|
11
|
+
NjFkMGI3M2EyYjcxYjkzNGMxZmRjMWQxYjM3MWEyZDg5ZDE4ZWQ=
|
|
12
|
+
data.tar.gz: !binary |-
|
|
13
|
+
YWVlY2U0Y2E0NDVjYWZkODgwMmFkZGQ2NTEyYTZlNzA1OWQwNmJiYTFiMjkz
|
|
14
|
+
MzAzZjIyMWI2N2Q4MGFmN2UxMjI5OGI3MTM3YjAwZjQyZjQ2YjljNjZiNDg5
|
|
15
|
+
OGFiNmNkOGE0NGY2MmU2ODhiM2JmN2JiMmQ3OGM3YTM3YjJmYjA=
|
data/lib/htmlrender.rb
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module HtmlRender
|
|
2
|
+
def render_html_content(*args, &block)
|
|
3
|
+
temp_render_args = HtmlRender._normalized_args(*args, &block)
|
|
4
|
+
temp_render_args[:formats] ||= []
|
|
5
|
+
temp_render_args[:formats] += [:html] unless temp_render_args[:formats].include?(:html)
|
|
6
|
+
|
|
7
|
+
# declare so below reference is not block-local
|
|
8
|
+
content = ""
|
|
9
|
+
|
|
10
|
+
_render_with_format :html do
|
|
11
|
+
content = render_to_string(temp_render_args).html_safe
|
|
12
|
+
end
|
|
13
|
+
content
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def _render_with_format(format, &block)
|
|
17
|
+
old_formats = formats
|
|
18
|
+
self.formats = [format]
|
|
19
|
+
block.call
|
|
20
|
+
self.formats = old_formats
|
|
21
|
+
nil
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class HtmlRender
|
|
25
|
+
def self._normalized_args(action=nil, options={}, &blk) #:nodoc:
|
|
26
|
+
case action
|
|
27
|
+
when NilClass
|
|
28
|
+
when Hash
|
|
29
|
+
options = action
|
|
30
|
+
when String, Symbol
|
|
31
|
+
action = action.to_s
|
|
32
|
+
key = action.include?(?/) ? :file : :action
|
|
33
|
+
options[key] = action
|
|
34
|
+
else
|
|
35
|
+
options[:partial] = action
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
options[:update] = blk if block_given?
|
|
39
|
+
|
|
40
|
+
options
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: htmlrender
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jason Fleetwood-Boldt
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-08-06 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: ''
|
|
14
|
+
email: jason@datatravels.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/htmlrender.rb
|
|
20
|
+
homepage: http://rubygems.org/gems/htmlrender
|
|
21
|
+
licenses:
|
|
22
|
+
- MIT
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ! '>='
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ! '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubyforge_project:
|
|
40
|
+
rubygems_version: 2.2.2
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: ''
|
|
44
|
+
test_files: []
|