Module: Tabulard::Table::ClassMethods

Defined in:
lib/tabulard/table.rb

Instance Method Summary collapse

Instance Method Details

#open(*args, **opts) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/tabulard/table.rb', line 23

def open(*args, **opts)
  table = new(*args, **opts)
  return Utils::MonadicResult::Success.new(table) unless block_given?

  begin
    yield table
  ensure
    table.close
  end
rescue InputError
  Utils::MonadicResult::Failure.new
end