Sha256: 23697ccd58534379e7aad53a396e561ce7fdb9b70976d72b365274debdb1f78c

Contents?: true

Size: 797 Bytes

Versions: 2

Compression:

Stored size: 797 Bytes

Contents

module SpecI18n
  
  # Return the new NaturalLanguage from spec language configuration
  #
  def natural_language
    Parser::NaturalLanguage.new(spec_language)
  end
  
  # Read the configuration language put in the Spec::Runner configure block
  #
  def spec_language
    Spec::Runner.configuration.language
  end
  
  # Return all the languages in languages.yml
  #
  def all_languages
    SpecI18n::SPEC_LANGUAGES
  end
  
  # Return the exaclty value of that keyword
  #
  def grep_value(lang, key)
    SpecI18n::SPEC_LANGUAGES[lang][key]
  end
  
  # List all languages available in the languages.yml
  #
  def list_languages
    languages = all_languages.keys.sort.collect do |lang|
      [ lang, grep_value(lang, 'name'), grep_value(lang, 'native') ]
    end
  end
  
end

include SpecI18n

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-i18n-1.2.1 lib/spec-i18n/spec_language.rb
rspec-i18n-1.2.0 lib/spec-i18n/spec_language.rb