Class: ROM::SQL::Relation

Inherits:
Relation
  • Object
show all
Extended by:
ClassMethods
Includes:
Associations, Inspection, Reading, Writing
Defined in:
lib/rom/sql/relation.rb,
lib/rom/sql/relation/reading.rb,
lib/rom/sql/relation/writing.rb,
lib/rom/sql/relation/inspection.rb,
lib/rom/sql/relation/associations.rb,
lib/rom/sql/relation/class_methods.rb

Overview

Sequel-specific relation extensions

Defined Under Namespace

Modules: Associations, ClassMethods, Inspection, Reading, Writing

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ClassMethods

finalize, inherited, many_to_many, many_to_one, one_to_many

Methods included from Reading

#count, #distinct, #exclude, #first, #group, #group_and_count, #inner_join, #invert, #last, #left_join, #limit, #map, #offset, #order, #prefix, #project, #qualified, #qualified_columns, #rename, #reverse, #select, #select_append, #select_group, #unique?, #where

Methods included from Writing

#delete, #insert, #multi_insert, #update

Methods included from Associations

#association_join, #association_left_join, #graph, #graph_join

Methods included from Inspection

#model, #primary_key

Constructor Details

#initialize(dataset, registry = {}) ⇒ Relation

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Relation.



32
33
34
35
# File 'lib/rom/sql/relation.rb', line 32

def initialize(dataset, registry = {})
  super
  @table = dataset.opts[:from].first
end

Instance Attribute Details

#headerHeader (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return a header for this relation

Returns:



24
25
26
# File 'lib/rom/sql/relation.rb', line 24

def header
  @header
end

#tableObject (readonly)

Name of the table used in FROM clause



29
30
31
# File 'lib/rom/sql/relation.rb', line 29

def table
  @table
end

Instance Method Details

#columnsArray<Symbol>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return raw column names

Returns:

  • (Array<Symbol>)


51
52
53
# File 'lib/rom/sql/relation.rb', line 51

def columns
  dataset.columns
end