module Kenma::Macro::MacroFunction
Public Instance Methods
macro_functions()
click to toggle source
# File lib/kenma/macro/macro_function.rb, line 29 def macro_functions singleton_class.ancestors.grep(Kenma::Macroable).map(&:macro_functions).inject([], &:+) end
send_macro_function(method_name, args, &block)
click to toggle source
# File lib/kenma/macro/macro_function.rb, line 33 def send_macro_function(method_name, args, &block) converted_args = compile(args) send(method_name, *converted_args&.children&.compact, &block) end
Private Instance Methods
_FCALL_send_macro_function(node, parent)
click to toggle source
# File lib/kenma/macro/macro_function.rb, line 42 def _FCALL_send_macro_function(node, parent) return node if parent&.type == :ITER method_name, args = node.children if macro_functions.include?(method_name) send_macro_function(method_name, args) else node end end
_ITER_send_macro_function(node, parent)
click to toggle source
# File lib/kenma/macro/macro_function.rb, line 53 def _ITER_send_macro_function(node, parent) fcall, scope = node.children method_name, args = fcall.children if macro_functions.include?(method_name) send_macro_function(method_name, args) { scope } else node end end