Class: Rasti::DB::NQL::Nodes::Attribute

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/rasti/db/nql/nodes/attribute.rb

Instance Method Summary collapse

Instance Method Details

#columnObject



19
20
21
# File 'lib/rasti/db/nql/nodes/attribute.rb', line 19

def column
  _column.text_value.to_sym
end

#computed_attributes(collection_class) ⇒ Object



23
24
25
# File 'lib/rasti/db/nql/nodes/attribute.rb', line 23

def computed_attributes(collection_class)
  computed?(collection_class) ? [column] : []
end

#identifier(collection_class) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/rasti/db/nql/nodes/attribute.rb', line 7

def identifier(collection_class)
  if computed? collection_class
    collection_class.computed_attributes[column].identifier
  else
    tables.empty? ? Sequel[column] : Sequel[tables.join('__').to_sym][column]
  end
end

#tablesObject



15
16
17
# File 'lib/rasti/db/nql/nodes/attribute.rb', line 15

def tables
  _tables.elements.map{ |e| e.table.text_value }
end