class Imagen::Node::Block

Represents a Ruby block

Public Instance Methods

build_from_ast(_ast_node) click to toggle source
Calls superclass method Imagen::Node::Base#build_from_ast
# File lib/imagen/node.rb, line 168
def build_from_ast(_ast_node)
  super
  tap { @name = ['block', args_list].compact.join(' ') }
end
human_name() click to toggle source
# File lib/imagen/node.rb, line 173
def human_name
  'block'
end

Private Instance Methods

args_list() click to toggle source
# File lib/imagen/node.rb, line 179
def args_list
  arg_nodes = ast_node.children.find { |n| n.type == :args }.children
  arg_names = arg_nodes.map { |arg| arg.children[0] }
  return if arg_names.empty?

  "(#{arg_names.join(', ')})"
end