module Crudboy::Extension
Public Instance Methods
t()
click to toggle source
# File lib/crudboy/definition.rb, line 6 def t puts Terminal::Table.new { |t| v.each { |row| t << (row || :separator) } } end
to_insert_sql()
click to toggle source
# File lib/crudboy/definition.rb, line 22 def to_insert_sql self.class.to_insert_sql([self]) end
to_upsert_sql()
click to toggle source
# File lib/crudboy/definition.rb, line 26 def to_upsert_sql self.class.to_upsert_sql([self]) end
v()
click to toggle source
# File lib/crudboy/definition.rb, line 12 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)
click to toggle source
# File lib/crudboy/definition.rb, line 30 def write_csv(filename, *fields, **options) [self].write_csv(filename, *fields, **options) end
write_excel(filename, *fields, **options)
click to toggle source
# File lib/crudboy/definition.rb, line 34 def write_excel(filename, *fields, **options) [self].write_excel(filename, *fields, **options) end