ilex 0.1.8 → 0.1.9
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/CHANGELOG.md +7 -0
- data/Gemfile.lock +2 -2
- data/lib/ilex/component.rb +2 -3
- data/lib/ilex/context.rb +2 -22
- data/lib/ilex/rails_ext/action_view/base.rb +12 -5
- data/lib/ilex/version.rb +1 -1
- 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: 52dca54a1d2d71e2ef66b74507d0ac0e6d72c68ade1c7993cfd524564869636a
|
4
|
+
data.tar.gz: 765e2c30ac981634ea6fcb4b07f484ef6fecdf9cb99947ccb783d816e5787e74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55d1bbc9f3153568d3d13e03fd4c11a7aef6450bdd30c16065ef1a0e6e95967158418817d8fe2bed8a5975fef03c4b4eee1a9e8908882b5cbba7f72f615a4e89
|
7
|
+
data.tar.gz: 29074aba634643602d17ab0a3f4a7841711fa525fd33836dbf3c1c8fcd2eae7f4e5985ba25c9df692fc71043715a5c2f70f38a498dfecd32a6d325a8a3c0bd5c
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
4
4
|
|
5
|
+
### [0.1.9](https://github.com/joshleblanc/ilex/compare/v0.1.8...v0.1.9) (2021-07-24)
|
6
|
+
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
* when block returns an arbre element, render context ([e3eda72](https://github.com/joshleblanc/ilex/commit/e3eda728fd30bcb15ebb3f5234229b644bbcf59a))
|
11
|
+
|
5
12
|
### [0.1.8](https://github.com/joshleblanc/ilex/compare/v0.1.7...v0.1.8) (2021-06-16)
|
6
13
|
|
7
14
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ilex (0.1.
|
4
|
+
ilex (0.1.9)
|
5
5
|
arbre
|
6
6
|
rails (>= 5.2, < 7.0)
|
7
7
|
|
@@ -142,7 +142,7 @@ GEM
|
|
142
142
|
rubocop-ast (1.4.1)
|
143
143
|
parser (>= 2.7.1.5)
|
144
144
|
ruby-progressbar (1.11.0)
|
145
|
-
ruby2_keywords (0.0.
|
145
|
+
ruby2_keywords (0.0.5)
|
146
146
|
sprockets (4.0.2)
|
147
147
|
concurrent-ruby (~> 1.0)
|
148
148
|
rack (> 1, < 3)
|
data/lib/ilex/component.rb
CHANGED
@@ -21,8 +21,8 @@ module Ilex
|
|
21
21
|
|
22
22
|
def render(*args, &blk)
|
23
23
|
define_method :call do
|
24
|
-
ctx = Context.new(self)
|
25
|
-
ctx.instance_eval(&blk).
|
24
|
+
@ctx = Context.new(self)
|
25
|
+
@ctx.instance_eval(&blk).html_safe
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -42,7 +42,6 @@ module Ilex
|
|
42
42
|
adjusted_name = name.chomp("Component").underscore
|
43
43
|
raise(NameError, "undefined local variable or method `#{adjusted_name}` for #{self}")
|
44
44
|
end
|
45
|
-
|
46
45
|
end
|
47
46
|
end
|
48
47
|
end
|
data/lib/ilex/context.rb
CHANGED
@@ -28,28 +28,8 @@ module Ilex
|
|
28
28
|
@component_wardens ||= ComponentWardens.new(@component)
|
29
29
|
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
#
|
34
|
-
# Not 100% sure this is needed, but view_components won't render their
|
35
|
-
# contents without it, when rendered in an arbre tree
|
36
|
-
def render(*args)
|
37
|
-
rendered = helpers.render(*args) do
|
38
|
-
if block_given?
|
39
|
-
contents = yield
|
40
|
-
if contents.is_a? Array
|
41
|
-
contents.join.html_safe
|
42
|
-
else
|
43
|
-
contents.html_safe
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
case rendered
|
48
|
-
when Arbre::Context
|
49
|
-
current_arbre_element.add_child rendered
|
50
|
-
else
|
51
|
-
text_node rendered
|
52
|
-
end
|
31
|
+
def render(*args, &blk)
|
32
|
+
helpers.render(*args, &blk)
|
53
33
|
end
|
54
34
|
|
55
35
|
def respond_to_missing?(method, include_all)
|
@@ -5,11 +5,18 @@ module Ilex
|
|
5
5
|
def capture(*args)
|
6
6
|
value = nil
|
7
7
|
buffer = with_output_buffer { value = yield(*args) }
|
8
|
-
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
|
8
|
+
|
9
|
+
# if args.first&.respond_to? :ctx
|
10
|
+
# value = args.first.ctx.children.to_s
|
11
|
+
# end
|
12
|
+
# We're only capturing the last returned arbre element
|
13
|
+
# This uses that element to get the current context, and
|
14
|
+
# get the html for the whole tree
|
15
|
+
# We have to collect the children manually because
|
16
|
+
# `content` is overridden
|
17
|
+
if value.is_a? Arbre::Element
|
18
|
+
value = value.arbre_context.children.to_s
|
19
|
+
end
|
13
20
|
|
14
21
|
if (string = buffer.presence || value) && string.is_a?(String)
|
15
22
|
ERB::Util.html_escape string
|
data/lib/ilex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ilex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua LeBlanc
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arbre
|