Sha256: 82a17ab364f7e37db172bcd240e2b67cf2babb4dfae9b5dcbcb496ea7248b502

Contents?: true

Size: 532 Bytes

Versions: 1

Compression:

Stored size: 532 Bytes

Contents

require 'wyrm/db_pump'

module PumpMaker
  def call_or_self( maybe_callable )
    if maybe_callable.respond_to? :call
      maybe_callable.call( self )
    else
      maybe_callable
    end
  end

  def make_pump( db, pump_thing )
    call_or_self(pump_thing) || DbPump.new( db: db )
  end

  def maybe_deebe( db_or_string )
    case db_or_string
    when String
      Sequel.connect db_or_string
    when Sequel::Database
      db_or_string
    else
      raise "Don't know how to db-ify #{db_or_string.inspect}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wyrm-0.2.1 lib/wyrm/pump_maker.rb