Class: I18nAdd::CLI::CLIConfig
- Inherits:
-
Object
- Object
- I18nAdd::CLI::CLIConfig
- Defined in:
- lib/i18n_add/cli.rb
Overview
Configuration object to hold CLI options and translations
Instance Attribute Summary collapse
-
#file_template ⇒ Object
Returns the value of attribute file_template.
-
#help_requested ⇒ Object
Returns the value of attribute help_requested.
-
#translations ⇒ Object
readonly
Returns the value of attribute translations.
Instance Method Summary collapse
- #add_translation(translation_string) ⇒ Object
- #default_file_template ⇒ Object
- #effective_file_template ⇒ Object
- #has_custom_file_template? ⇒ Boolean
-
#initialize ⇒ CLIConfig
constructor
A new instance of CLIConfig.
Constructor Details
#initialize ⇒ CLIConfig
Returns a new instance of CLIConfig.
114 115 116 117 118 |
# File 'lib/i18n_add/cli.rb', line 114 def initialize @translations = [] @file_template = nil @help_requested = false end |
Instance Attribute Details
#file_template ⇒ Object
Returns the value of attribute file_template.
112 113 114 |
# File 'lib/i18n_add/cli.rb', line 112 def file_template @file_template end |
#help_requested ⇒ Object
Returns the value of attribute help_requested.
112 113 114 |
# File 'lib/i18n_add/cli.rb', line 112 def help_requested @help_requested end |
#translations ⇒ Object (readonly)
Returns the value of attribute translations.
111 112 113 |
# File 'lib/i18n_add/cli.rb', line 111 def translations @translations end |
Instance Method Details
#add_translation(translation_string) ⇒ Object
120 121 122 |
# File 'lib/i18n_add/cli.rb', line 120 def add_translation(translation_string) @translations << translation_string end |
#default_file_template ⇒ Object
128 129 130 |
# File 'lib/i18n_add/cli.rb', line 128 def default_file_template "config/locales/%<locale>s/main.%<locale>s.yml" end |
#effective_file_template ⇒ Object
132 133 134 |
# File 'lib/i18n_add/cli.rb', line 132 def effective_file_template @file_template || default_file_template end |
#has_custom_file_template? ⇒ Boolean
124 125 126 |
# File 'lib/i18n_add/cli.rb', line 124 def has_custom_file_template? !@file_template.nil? end |