Class: AutoSqlFormatter::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/auto_sql_formatter/core.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

DEFAULT_DIR =
'app'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir = DEFAULT_DIR) ⇒ Core

Returns a new instance of Core.



8
9
10
# File 'lib/auto_sql_formatter/core.rb', line 8

def initialize(dir = DEFAULT_DIR)
  @workdir = dir
end

Instance Attribute Details

#workdirObject (readonly)

Returns the value of attribute workdir.



6
7
8
# File 'lib/auto_sql_formatter/core.rb', line 6

def workdir
  @workdir
end

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/auto_sql_formatter/core.rb', line 12

def execute
  puts "========Start to format sql========="
  puts
  files.each do |file|
    result = Runner.do file[:path]
    display(file[:status] = result)
  end
  puts
  puts
  files.each do |file| 
    puts "#{file[:path]}  #{file[:status]}\n"
  end
  puts
  puts '===========Completed!!!============'
end