Class: I18nAdd::CLI::CLIConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_add/cli.rb

Overview

Configuration object to hold CLI options and translations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCLIConfig

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_templateObject

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_requestedObject

Returns the value of attribute help_requested.



112
113
114
# File 'lib/i18n_add/cli.rb', line 112

def help_requested
  @help_requested
end

#translationsObject (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_templateObject



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_templateObject



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

Returns:

  • (Boolean)


124
125
126
# File 'lib/i18n_add/cli.rb', line 124

def has_custom_file_template?
  !@file_template.nil?
end