Class: TokyoMetro::Rake::Rails::Deploy::Heroku::Csv::Command::MetaClass

Inherits:
Object
  • Object
show all
Defined in:
lib/tokyo_metro/rake/rails/deploy/heroku/csv/command/meta_class.rb

Defined Under Namespace

Classes: Table

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time = nil) ⇒ MetaClass

Returns a new instance of MetaClass.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/tokyo_metro/rake/rails/deploy/heroku/csv/command/meta_class.rb', line 3

def initialize( time = nil )
  # tables_from_file = ::File.open( "#{ ::Rails.root }/db/tables.txt" , "r:utf-8" ).read
  tables_from_file = ::ActiveRecord::Base.connection.tables.sort
  # tables_from_file = open( "#{ ::Rails.root }/db/tables.txt" , "r:utf-8" ).read.split( /\n/ )

  @tables = tables_from_file.map { | table | Table.new( table ) }
  @commands = ::Array.new
  set_time( time )
  optional_setting_of_initializer
  ::FileUtils.mkdir_p( @dirname ) unless ::Dir.exist?( @dirname )

  puts "-" * 32 + " Time: #{ @time }"
  puts "-" * 32 + " Dirname: #{ @dirname }"
  puts ""
end

Instance Attribute Details

#timeObject (readonly)

Returns the value of attribute time.



19
20
21
# File 'lib/tokyo_metro/rake/rails/deploy/heroku/csv/command/meta_class.rb', line 19

def time
  @time
end

Instance Method Details

#to_sObject



21
22
23
24
25
26
# File 'lib/tokyo_metro/rake/rails/deploy/heroku/csv/command/meta_class.rb', line 21

def to_s
  set_first_settings_to_s
  set_commands_for_db

  @commands.flatten
end