Class: CodeCaser::Caser

Inherits:
Object
  • Object
show all
Defined in:
lib/code_caser/caser.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Caser

Returns a new instance of Caser.



7
8
9
10
11
12
# File 'lib/code_caser/caser.rb', line 7

def initialize(opts = {})
  @converter         = opts[:converter]
  @path              = File.directory?(opts[:path]) ? File.join(opts[:path], "*") : opts[:path]
  @save              = opts[:save] || true
  @verbose           = opts[:verbose] || false
end

Instance Method Details

#startObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/code_caser/caser.rb', line 14

def start
  files = get_files
  if files.empty?
    puts "File or folder not found.\n"
    return
  elsif user_aborted?(files)
    puts "File conversion aborted.\n"
    return
  end
  convert_files(files)
  puts "\n#{files.count} file(s) converted.".colorize(:green)
  puts "Backup copies of the original files can be found here:".colorize(:green)
  puts "#{backup_folder}\n"
end