Module: SpecI18n

Defined in:
lib/spec-i18n/platform.rb,
lib/spec-i18n/spec_language.rb,
lib/spec-i18n/command_line/main.rb,
lib/spec-i18n/command_line/options.rb,
lib/spec-i18n/parser/natural_language.rb,
lib/spec-i18n/command_line/language_help_formatter.rb

Defined Under Namespace

Modules: CommandLine, Parser

Constant Summary collapse

VERSION =
[version[:major], version[:minor], version[:patch]].compact.join(".")
SPEC_LANGUAGE_FILE =
File.expand_path(File.dirname(__FILE__) + '/languages.yml')
SPEC_LANGUAGES =
YAML.load_file(SPEC_LANGUAGE_FILE)

Instance Method Summary collapse

Instance Method Details

#all_languagesObject

Return all the languages in languages.yml



17
18
19
# File 'lib/spec-i18n/spec_language.rb', line 17

def all_languages
  SpecI18n::SPEC_LANGUAGES
end

#grep_value(lang, key) ⇒ Object

Return the exaclty value of that keyword



23
24
25
# File 'lib/spec-i18n/spec_language.rb', line 23

def grep_value(lang, key)
  SpecI18n::SPEC_LANGUAGES[lang][key]
end

#list_languagesObject

List all languages available in the languages.yml



29
30
31
32
33
# File 'lib/spec-i18n/spec_language.rb', line 29

def list_languages
  languages = all_languages.keys.sort.collect do |lang|
    [ lang, grep_value(lang, 'name'), grep_value(lang, 'native') ]
  end
end

#natural_languageObject

Return the new NaturalLanguage from spec language configuration



5
6
7
# File 'lib/spec-i18n/spec_language.rb', line 5

def natural_language
  Parser::NaturalLanguage.new(spec_language)
end

#spec_languageObject

Read the configuration language put in the Spec::Runner configure block



11
12
13
# File 'lib/spec-i18n/spec_language.rb', line 11

def spec_language
  Spec::Runner.configuration.language
end