ilex 0.1.5 → 0.1.6

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
  SHA256:
3
- metadata.gz: fbd721cabba89d7f34b23841b6afcfd3d38b79bb35d947a620161e67e6f38cfd
4
- data.tar.gz: 3aca8a08c6ae10f7918bcb239bbe103cd03073d18e1c30fc746a509c30c127f9
3
+ metadata.gz: 4f98672db74bb9e94ee80eb636e5878900d5a348fd4879633d5e44dcbc289053
4
+ data.tar.gz: 6cccb6d5f4a506995fe4549f249ba0cd5150d8e3b26955985f1a5b25d9d4b359
5
5
  SHA512:
6
- metadata.gz: cb7d4800158d6b0dfb093ffd0f44abbb6009bc8bb8c706125e108fe89c5dbff0e16c50a1d8502b12c846416f8986a61d6b7a5fa9c5e52a5ca0f0600ae8df2816
7
- data.tar.gz: af85c50eedefbbe3ce29849e07c80f38de08037277a57bc71477bd04d67326d8f8af7ae973fb18ddd93d0b13e11c15acf09d588389a46ad65b843f9808dc84a2
6
+ metadata.gz: 97243cd6826be3e81e93dd847adcbc50a36045865bc67c325524a4945dc7690479a9a15037b061edfd7b2c18c377ebda444d80a44b009a8afca2c2b78a022d81
7
+ data.tar.gz: db12e3bb02e3e7277bbf2a15e40839616b64b283733fe9ba1cf17bf28029383ca9b2c246aaa7eef2ddaa56a1cd5f0c1009605d040853133416e3d64732f92a87
data/.versionrc.json CHANGED
@@ -3,5 +3,5 @@
3
3
  "tag": true
4
4
  },
5
5
  "NAME": "Ilex",
6
- "VERSION": "0.1.0"
6
+ "VERSION": "0.1.6"
7
7
  }
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.6](https://github.com/joshleblanc/cedar/compare/v0.1.5...v0.1.6) (2021-04-18)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * allow rendering form helpers with blocks ([9a24ed7](https://github.com/joshleblanc/cedar/commit/9a24ed7388c60f7a7ed4398dc4871974302c87f3)), closes [activeadmin/arbre#64](https://github.com/activeadmin/arbre/issues/64)
11
+
5
12
  ### [0.1.5](https://github.com/joshleblanc/cedar/compare/v0.1.4...v0.1.5) (2021-04-17)
6
13
 
7
14
 
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ilex (0.1.5)
4
+ ilex (0.1.6)
5
5
  arbre
6
+ rails (>= 5.2, < 7.0)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
data/cedar.gemspec CHANGED
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
  # Uncomment to register a new dependency of your gem
33
33
  # spec.add_dependency "example-gem", "~> 1.0"
34
34
  spec.add_dependency "arbre"
35
+ spec.add_dependency "rails", [">= 5.2", "< 7.0"]
35
36
 
36
37
  # For more information and examples about making a new gem, checkout our
37
38
  # guide at: https://bundler.io/guides/creating_gem.html
data/lib/ilex.rb CHANGED
@@ -6,8 +6,12 @@ require_relative "ilex/component_warden"
6
6
  require_relative "ilex/component_wardens"
7
7
  require_relative "ilex/context"
8
8
  require_relative "ilex/component"
9
+ require_relative "ilex/arbre_ext/element"
10
+ require_relative "ilex/rails_ext/action_view/base"
11
+ require_relative "ilex/engine"
9
12
 
10
13
  module Ilex
11
14
  class Error < StandardError; end
12
15
  # Your code goes here...
13
16
  end
17
+
@@ -0,0 +1,27 @@
1
+ module Ilex
2
+ module ArbreExt
3
+ module Element
4
+ ruby2_keywords def method_missing(name, *args, &block)
5
+ if current_arbre_element.respond_to?(name)
6
+ current_arbre_element.send name, *args, &block
7
+ elsif assigns && assigns.has_key?(name)
8
+ assigns[name]
9
+ elsif helpers.respond_to?(name)
10
+ helper_capture(name, *args, &block)
11
+ else
12
+ super
13
+ end
14
+ end
15
+
16
+ # The helper might have a block that builds Arbre elements
17
+ # which will be rendered (#to_s) inside ActionView::Base#capture.
18
+ # We do not want such elements added to self, so we push a dummy
19
+ # current_arbre_element.
20
+ def helper_capture(name, *args, &block)
21
+ s = ""
22
+ within(Element.new) { s = helpers.send(name, *args, &block) }
23
+ s.is_a?(Element) ? s.to_s : s
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,9 @@
1
+ module Ilex
2
+ class Engine < ::Rails::Engine
3
+
4
+ config.to_prepare do
5
+ ActionView::Base.prepend RailsExt::ActionView::Base
6
+ Arbre::Element.prepend ArbreExt::Element
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ module Ilex
2
+ module RailsExt
3
+ module ActionView
4
+ module Base
5
+ def capture(*args)
6
+ value = nil
7
+ buffer = with_output_buffer { value = yield(*args) }
8
+
9
+ # Override to handle Arbre elements inside helper blocks.
10
+ # See https://github.com/rails/rails/issues/17661
11
+ # and https://github.com/rails/rails/pull/18024#commitcomment-8975180
12
+ value = value.to_s if value.is_a?(Arbre::Element)
13
+
14
+ if (string = buffer.presence || value) && string.is_a?(String)
15
+ ERB::Util.html_escape string
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
data/lib/ilex/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ilex
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
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.5
4
+ version: 0.1.6
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-04-17 00:00:00.000000000 Z
11
+ date: 2021-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arbre
@@ -24,6 +24,26 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '5.2'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '7.0'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '5.2'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '7.0'
27
47
  description: Extends view components to allow rendering inline arbre templates
28
48
  email:
29
49
  - jleblanc@hey.com
@@ -46,10 +66,13 @@ files:
46
66
  - bin/setup
47
67
  - cedar.gemspec
48
68
  - lib/ilex.rb
69
+ - lib/ilex/arbre_ext/element.rb
49
70
  - lib/ilex/component.rb
50
71
  - lib/ilex/component_warden.rb
51
72
  - lib/ilex/component_wardens.rb
52
73
  - lib/ilex/context.rb
74
+ - lib/ilex/engine.rb
75
+ - lib/ilex/rails_ext/action_view/base.rb
53
76
  - lib/ilex/version.rb
54
77
  homepage: https://github.com/joshleblanc/ilex
55
78
  licenses: