Module: Tramp

Defined in:
lib/tramp/column.rb,
lib/tramp.rb,
lib/tramp/base.rb,
lib/tramp/engine.rb,
lib/tramp/status.rb,
lib/tramp/finders.rb,
lib/tramp/quoting.rb,
lib/tramp/relation.rb,
lib/tramp/attribute.rb,
lib/tramp/callbacks.rb,
lib/tramp/attribute_methods.rb,
lib/tramp/engine/connection.rb

Overview

Copyright © 2009 Koziarski Software Ltd

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Defined Under Namespace

Modules: AttributeMethods, Callbacks, Finders, Quoting Classes: Attribute, Base, Column, Engine, Relation, Status

Constant Summary collapse

VERSION =
'0.2'

Class Method Summary collapse

Class Method Details

.init(settings) ⇒ Object



38
39
40
# File 'lib/tramp.rb', line 38

def self.init(settings)
  Arel::Table.engine = Tramp::Engine.new(settings)
end

.select(query, callback = nil, &block) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/tramp.rb', line 42

def self.select(query, callback = nil, &block)
  callback ||= block

  EventedMysql.select(query) do |rows|
    callback.arity == 1 ? callback.call(rows) : callback.call if callback
  end
end