Class: Lokale::Action
- Inherits:
-
Object
- Object
- Lokale::Action
- Defined in:
- lib/lokale.rb,
lib/lokale/config.rb
Instance Attribute Summary collapse
-
#arg ⇒ Object
Returns the value of attribute arg.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
- .append ⇒ Object
- .copy_base ⇒ Object
- .create_config ⇒ Object
- .export ⇒ Object
- .import ⇒ Object
- .summary ⇒ Object
Instance Method Summary collapse
-
#initialize(type) ⇒ Action
constructor
A new instance of Action.
- #perform(agent, reporter) ⇒ Object
- #perform_append(agent, reporter) ⇒ Object
- #perform_copy_base(agent, reporter) ⇒ Object
- #perform_create_config(agent, reporter) ⇒ Object
- #perform_export(agent, reporter) ⇒ Object
- #perform_import(agent, reporter) ⇒ Object
- #perform_summary(agent, reporter) ⇒ Object
- #print(str) ⇒ Object
Constructor Details
#initialize(type) ⇒ Action
Returns a new instance of Action.
9 10 11 |
# File 'lib/lokale/config.rb', line 9 def initialize(type) @type = type end |
Instance Attribute Details
#arg ⇒ Object
Returns the value of attribute arg.
7 8 9 |
# File 'lib/lokale/config.rb', line 7 def arg @arg end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/lokale/config.rb', line 7 def type @type end |
Class Method Details
.append ⇒ Object
15 |
# File 'lib/lokale/config.rb', line 15 def self.append; Action.new(:append) end |
.copy_base ⇒ Object
14 |
# File 'lib/lokale/config.rb', line 14 def self.copy_base; Action.new(:copy_base) end |
.create_config ⇒ Object
18 |
# File 'lib/lokale/config.rb', line 18 def self.create_config; Action.new(:create_config) end |
.export ⇒ Object
16 |
# File 'lib/lokale/config.rb', line 16 def self.export; Action.new(:export) end |
.import ⇒ Object
17 |
# File 'lib/lokale/config.rb', line 17 def self.import; Action.new(:import) end |
.summary ⇒ Object
13 |
# File 'lib/lokale/config.rb', line 13 def self.summary; Action.new(:summary) end |
Instance Method Details
#perform(agent, reporter) ⇒ Object
15 16 17 |
# File 'lib/lokale.rb', line 15 def perform(agent, reporter) send(("perform_" + @type.to_s).to_sym, agent, reporter) end |
#perform_append(agent, reporter) ⇒ Object
29 30 31 32 |
# File 'lib/lokale.rb', line 29 def perform_append(agent, reporter) print "Appending new macro calls to localization files...".blue agent.append_new_macro_calls end |
#perform_copy_base(agent, reporter) ⇒ Object
24 25 26 27 |
# File 'lib/lokale.rb', line 24 def perform_copy_base(agent, reporter) print "Copying `en` strings files to `Base`...".blue agent.copy_base end |
#perform_create_config(agent, reporter) ⇒ Object
44 45 46 47 |
# File 'lib/lokale.rb', line 44 def perform_create_config(agent, reporter) print "Creating config file...".blue Config.get.create_default_file end |
#perform_export(agent, reporter) ⇒ Object
34 35 36 37 |
# File 'lib/lokale.rb', line 34 def perform_export(agent, reporter) print "Preparing xliff files with new localized strings...".blue agent.export_xliffs end |
#perform_import(agent, reporter) ⇒ Object
39 40 41 42 |
# File 'lib/lokale.rb', line 39 def perform_import(agent, reporter) print "Attempting to import new strings...".blue agent.try_to_import end |
#perform_summary(agent, reporter) ⇒ Object
19 20 21 22 |
# File 'lib/lokale.rb', line 19 def perform_summary(agent, reporter) print "Printing summary...".blue reporter.print_summary end |
#print(str) ⇒ Object
11 12 13 |
# File 'lib/lokale.rb', line 11 def print(str) puts str.blue end |