hiccdown 1.2.0 → 1.2.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 +4 -4
- data/lib/hiccdown/railtie.rb +5 -2
- data/lib/hiccdown.rb +10 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 511a111c1a785fbf4e2bed70428763c957c864e2dfcb266aadd96df96cc11a01
|
4
|
+
data.tar.gz: 05bdf9c2dcc2e6ac2ca576b9b3e275301c33dff7724754dabd3aeacf919c7abe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 686991790952e22669ee7f050571744d62c8ea9191e9f623f5e4d9e63aeaf437f96fdaff2e19e82b4e9c103a7e40c758e0452000086b77e23061e7fbae2a3eb5
|
7
|
+
data.tar.gz: 55b1aa42edf4b366a0c7b1d543eaf8c9886c7794a5b536020a6cd68c436fb82697a2ad50639af016b7945cbda1d8b295cde03efc0e6c209eb5cdc475f6d65e39
|
data/lib/hiccdown/railtie.rb
CHANGED
@@ -66,6 +66,11 @@ module Hiccdown
|
|
66
66
|
|
67
67
|
def render_helper_method action_name, options = {}
|
68
68
|
helper_name = "#{controller_name.capitalize}Helper"
|
69
|
+
|
70
|
+
unless Object.const_defined?(helper_name)
|
71
|
+
return original_render({ action: action_name }.merge(options))
|
72
|
+
end
|
73
|
+
|
69
74
|
helper_module = helper_name.constantize
|
70
75
|
|
71
76
|
if helper_module.instance_methods(false).include?(action_name.to_sym)
|
@@ -76,8 +81,6 @@ module Hiccdown
|
|
76
81
|
else
|
77
82
|
original_render({ action: action_name }.merge(options))
|
78
83
|
end
|
79
|
-
rescue NameError # no helper with that name
|
80
|
-
original_render({ action: action_name }.merge(options))
|
81
84
|
end
|
82
85
|
end
|
83
86
|
end
|
data/lib/hiccdown.rb
CHANGED
@@ -14,19 +14,17 @@ module Hiccdown
|
|
14
14
|
|
15
15
|
module MethodOverrides
|
16
16
|
def self.prepended(base)
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
result.is_a?(Array) ? Hiccdown::to_html(result).html_safe : result
|
26
|
-
end
|
27
|
-
else
|
28
|
-
super(*args, **kwargs)
|
17
|
+
# `capture` is at the root of seemingly all Rails methods tasked with
|
18
|
+
# rendering content, including `content_tag` and `tag`, which in turn
|
19
|
+
# are used for `link_to`, `form_for`, etc.
|
20
|
+
define_method(:capture) do |*args, **kwargs, &block|
|
21
|
+
if block
|
22
|
+
super(*args, **kwargs) do |*brgs, **jwargs|
|
23
|
+
result = block.call(*brgs, *jwargs)
|
24
|
+
result.is_a?(Array) ? Hiccdown::to_html(result).html_safe : result
|
29
25
|
end
|
26
|
+
else
|
27
|
+
super(*args, **kwargs)
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiccdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Hackethal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Generates an HTML string from a Hiccup structure and improves Rails views.
|
14
14
|
email: engineering@dennishackethal.com
|