Module: PryHelper::Extension

Extended by:
ActiveSupport::Concern
Defined in:
lib/pry-helper/definition.rb

Instance Method Summary collapse

Instance Method Details

#dump(filename, batch_size = 500) ⇒ Object



49
50
51
# File 'lib/pry-helper/definition.rb', line 49

def dump(filename, batch_size=500)
  [self].dump(filename, batch_size)
end

#tObject



8
9
10
11
12
# File 'lib/pry-helper/definition.rb', line 8

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

#to_insert_sqlObject



33
34
35
# File 'lib/pry-helper/definition.rb', line 33

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

#to_upsert_sqlObject



37
38
39
# File 'lib/pry-helper/definition.rb', line 37

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

#vObject



23
24
25
26
27
28
29
30
31
# File 'lib/pry-helper/definition.rb', line 23

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

#vdObject



14
15
16
17
18
19
20
21
# File 'lib/pry-helper/definition.rb', line 14

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

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



41
42
43
# File 'lib/pry-helper/definition.rb', line 41

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

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



45
46
47
# File 'lib/pry-helper/definition.rb', line 45

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