Class: Localeapp::CLI::Add
- Inherits:
-
Object
- Object
- Localeapp::CLI::Add
- Defined in:
- lib/localeapp/cli/add.rb
Instance Method Summary collapse
- #execute(key, *translations) ⇒ Object
-
#initialize(output = $stdout) ⇒ Add
constructor
A new instance of Add.
Constructor Details
#initialize(output = $stdout) ⇒ Add
Returns a new instance of Add.
4 5 6 |
# File 'lib/localeapp/cli/add.rb', line 4 def initialize(output = $stdout) @output = output end |
Instance Method Details
#execute(key, *translations) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/localeapp/cli/add.rb', line 8 def execute(key, *translations) @output.puts "Localeapp Add" @output.puts "" translations.each do |translation| if translation =~ /([\w\-]+):(.*)/ locale, description = $1, $2 Localeapp.missing_translations.add(locale, key, description) else @output.puts "Ignoring bad translation #{translation}" @output.puts "format should be <locale>:<translation content>" end end @output.puts "Sending key: #{key}" Localeapp.sender.post_missing_translations @output.puts "Success!" end |