Class: Object

Inherits:
BasicObject
Includes:
Terminal::Table::TableHelper
Defined in:
lib/terminal-table/import.rb,
lib/terminal-table/core_ext.rb

Instance Method Summary collapse

Methods included from Terminal::Table::TableHelper

#table

Instance Method Details

#yield_or_eval(&block) ⇒ Object

Yields or instance_eval's a block depending on the arity of a block in order to support both types of block syntax for DSL's.



30
31
32
33
34
35
36
37
# File 'lib/terminal-table/core_ext.rb', line 30

def yield_or_eval &block
  return unless block
  if block.arity > 0
    yield self
  else
    self.instance_eval &block
  end
end