Class: RubyToUML::UMLInfoGenerator::BodyNodeWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_to_uml/uml_info_generator/processor_helpers.rb

Instance Method Summary collapse

Constructor Details

#initialize(body_node) ⇒ BodyNodeWrapper

Returns a new instance of BodyNodeWrapper.



191
192
193
# File 'lib/ruby_to_uml/uml_info_generator/processor_helpers.rb', line 191

def initialize(body_node)
  @body_node = body_node
end

Instance Method Details

#array_operation(&operation) ⇒ Object



195
196
197
198
199
200
201
202
203
204
205
# File 'lib/ruby_to_uml/uml_info_generator/processor_helpers.rb', line 195

def array_operation(&operation)
  array = []
  if body_node.nil?
    nil
  elsif body_node.type == :begin
    body_node.children.each { |node| operation.call(node, array) }
  else
    operation.call(body_node, array)
  end
  array
end

#simple_operation(&operation) ⇒ Object



207
208
209
210
211
212
213
214
215
# File 'lib/ruby_to_uml/uml_info_generator/processor_helpers.rb', line 207

def simple_operation(&operation)
  if body_node.nil?
    nil
  elsif body_node.type == :begin
    body_node.children.each { |node| operation.call(node) }
  else
    operation.call(body_node)
  end
end