Module: Arql::Extension

Extended by:
ActiveSupport::Concern
Defined in:
lib/arql/definition.rb

Instance Method Summary collapse

Instance Method Details

#tObject



5
6
7
8
9
# File 'lib/arql/definition.rb', line 5

def t
  puts Terminal::Table.new { |t|
    v.each { |row| t << (row || :separator) }
  }
end

#to_insert_sqlObject



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

def to_insert_sql
  self.class.to_insert_sql([self])
end

#to_upsert_sqlObject



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

def to_upsert_sql
  self.class.to_upsert_sql([self])
end

#vObject



11
12
13
14
15
16
17
18
19
# File 'lib/arql/definition.rb', line 11

def v
  t = []
  t << ['Attribute Name', 'Attribute Value', 'SQL Type', 'Comment']
  t << nil
  self.class.connection.columns(self.class.table_name).each do |column|
    t << [column.name, read_attribute(column.name), column.sql_type, column.comment || '']
  end
  t
end

#write_csv(filename, *fields, **options) ⇒ Object



29
30
31
# File 'lib/arql/definition.rb', line 29

def write_csv(filename, *fields, **options)
  [self].write_csv(filename, *fields, **options)
end

#write_excel(filename, *fields, **options) ⇒ Object



33
34
35
# File 'lib/arql/definition.rb', line 33

def write_excel(filename, *fields, **options)
  [self].write_excel(filename, *fields, **options)
end