Class: DB::Identifier

Inherits:
Array
  • Object
show all
Defined in:
lib/db/query.rb

Overview

Represents one or more identifiers for databases, tables or columns.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.coerce(name_or_identifier) ⇒ Object

Convert various input types to an Identifier instance.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/db/query.rb', line 12

def self.coerce(name_or_identifier)
  case name_or_identifier
  when Identifier
    name_or_identifier
  when Array
    self.new(name_or_identifier)
  when Symbol
    self[name_or_identifier]
  else
    self[name_or_identifier.to_sym]
  end
end

Instance Method Details

#append_to(query) ⇒ Object

Append this identifier to the provided query builder.



27
28
29
# File 'lib/db/query.rb', line 27

def append_to(query)
  query.identifier(self)
end