Module: Arboretum::DocTree::Elements::Loggable

Included in:
Element, Element
Defined in:
lib/arboretum/doctree.rb

Instance Method Summary collapse

Instance Method Details

#log(*method_names) ⇒ Object



419
420
421
422
423
424
425
426
427
# File 'lib/arboretum/doctree.rb', line 419

def log(*method_names)
  method_names.each do |name|
    method = instance_method(name)
    define_method(name) do |*args, &block|
      self.history << [name, args, caller]
      method.bind(self).(*args, &block)
    end
  end
end

#log_stringObject



428
429
430
431
432
# File 'lib/arboretum/doctree.rb', line 428

def log_string
  lines = ""
  self.history.each {|h| lines << h.inspect << "\n"}
  lines
end