Skip to content

Commit eab44c4

Browse files
deivid-rodriguezvaryonic
authored andcommitted
Use ruby2_keywords for the moment (activeadmin#205)
Without this gem, current activeadmin version becomes incompatible with the master branch of `arbre`. It shouldn't be an issue as long as we update activeadmin's code to use keyword arguments everywhere, set a minimum dependency on the next `arbre` and release both gems at the same time, but I think it's easier to be conservative.
1 parent f6f4511 commit eab44c4

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

arbre.gemspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@ Gem::Specification.new do |s|
1818
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
1919
s.require_paths = ["lib"]
2020

21+
s.required_ruby_version = '>= 2.5'
22+
2123
s.add_dependency("activesupport", ">= 3.0.0")
24+
s.add_dependency("ruby2_keywords", ">= 0.0.2")
2225
end

lib/arbre/context.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require 'arbre/element'
2+
require 'ruby2_keywords'
23

34
module Arbre
45

@@ -74,7 +75,7 @@ def respond_to_missing?(method, include_all)
7475
# Webservers treat Arbre::Context as a string. We override
7576
# method_missing to delegate to the string representation
7677
# of the html.
77-
def method_missing(method, *args, &block)
78+
ruby2_keywords def method_missing(method, *args, &block)
7879
if cached_html.respond_to? method
7980
cached_html.send method, *args, &block
8081
else

lib/arbre/element.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require 'arbre/element/builder_methods'
22
require 'arbre/element/proxy'
33
require 'arbre/element_collection'
4+
require 'ruby2_keywords'
45

56
module Arbre
67

@@ -191,7 +192,7 @@ def clear_children!
191192
# 3. Call the method on the helper object
192193
# 4. Call super
193194
#
194-
def method_missing(name, *args, &block)
195+
ruby2_keywords def method_missing(name, *args, &block)
195196
if current_arbre_element.respond_to?(name)
196197
current_arbre_element.send name, *args, &block
197198
elsif assigns && assigns.has_key?(name)
@@ -207,7 +208,7 @@ def method_missing(name, *args, &block)
207208
# which will be rendered (#to_s) inside ActionView::Base#capture.
208209
# We do not want such elements added to self, so we push a dummy
209210
# current_arbre_element.
210-
def helper_capture(name, *args, &block)
211+
ruby2_keywords def helper_capture(name, *args, &block)
211212
s = ""
212213
within(Element.new) { s = helpers.send(name, *args, &block) }
213214
s.is_a?(Element) ? s.to_s : s

0 commit comments

Comments
 (0)