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.



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

def initialize
  @options = collect_args
  validate_args
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



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

def count
  @count
end

#loggerObject

Returns the value of attribute logger.



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

def logger
  @logger
end

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

.instanceObject



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

def self.instance
  @instance ||= new
end

Instance Method Details

#runObject



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

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(translated)

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