Class: Tr4n5l4te::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/tr4n5l4te/runner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRunner

Returns a new instance of Runner.



17
18
19
20
# File 'lib/tr4n5l4te/runner.rb', line 17

def initialize
  @options = collect_args
  validate_args
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



11
12
13
# File 'lib/tr4n5l4te/runner.rb', line 11

def count
  @count
end

#loggerObject

Returns the value of attribute logger.



11
12
13
# File 'lib/tr4n5l4te/runner.rb', line 11

def logger
  @logger
end

#optionsObject

Returns the value of attribute options.



11
12
13
# File 'lib/tr4n5l4te/runner.rb', line 11

def options
  @options
end

Class Method Details

.instanceObject



13
14
15
# File 'lib/tr4n5l4te/runner.rb', line 13

def self.instance
  @instance ||= new
end

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/tr4n5l4te/runner.rb', line 22

def run
  start_time = Time.now
  log_identifier(start_time)
  @count = 0

  # configure
  Tr4n5l4te.configure do |config|
    config.timeout = options[:timeout]
  end

  hash = YAML.load_file(options[:yaml_file])
  translated = process(hash)
  store_translation(replace_lang_key(translated))

  puts("Processed #{@count} strings in [#{Time.now - start_time}] seconds.".yellow)
end