Module: Prequel

Extended by:
ActiveSupport::Autoload, Prequel
Included in:
Prequel
Defined in:
lib/prequel.rb,
lib/prequel/sql.rb,
lib/prequel/field.rb,
lib/prequel/tuple.rb,
lib/prequel/record.rb,
lib/prequel/session.rb,
lib/prequel/version.rb,
lib/prequel/relations.rb,
lib/prequel/sql/query.rb,
lib/prequel/expressions.rb,
lib/prequel/sql/subquery.rb,
lib/prequel/sql/table_ref.rb,
lib/prequel/composite_tuple.rb,
lib/prequel/core_extensions.rb,
lib/prequel/relations/table.rb,
lib/prequel/sql/query_column.rb,
lib/prequel/expressions/equal.rb,
lib/prequel/expressions/column.rb,
lib/prequel/relations/relation.rb,
lib/prequel/relations/selection.rb,
lib/prequel/sql/named_table_ref.rb,
lib/prequel/relations/inner_join.rb,
lib/prequel/relations/projection.rb,
lib/prequel/expressions/expression.rb,
lib/prequel/expressions/set_function.rb,
lib/prequel/sql/derived_query_column.rb,
lib/prequel/expressions/derived_column.rb,
lib/prequel/sql/inner_joined_table_ref.rb,
lib/prequel/expressions/aliased_expression.rb

Defined Under Namespace

Modules: Expressions, HashExtensions, PrimitiveExtensions, Relations, Sql, SymbolExtensions Classes: CompositeTuple, Field, Record, Session, Tuple

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#clear_sessionObject



25
26
27
# File 'lib/prequel.rb', line 25

def clear_session
  Thread.current[:prequel_session] = nil if Thread.current[:prequel_session]
end

#const_missing(name) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/prequel.rb', line 9

def const_missing(name)
  if name == :DB
    const_set(:DB, Sequel::DATABASES.first)
  else
    super
  end
end

#sessionObject



21
22
23
# File 'lib/prequel.rb', line 21

def session
  Thread.current[:prequel_session] ||= Session.new
end

#table(name, &block) ⇒ Object



17
18
19
# File 'lib/prequel.rb', line 17

def table(name, &block)
  Relations::Table.new(name, &block)
end