Module: Spec::DSL::Main

Defined in:
lib/spec-i18n/dsl/main.rb

Instance Method Summary collapse

Instance Method Details

#register_adverbsObject

Translate adverbs for the dsl keywords

{ “describe” => [“descreva”, “contexto”]}

Register alias for the language specified



11
12
13
14
15
# File 'lib/spec-i18n/dsl/main.rb', line 11

def register_adverbs
  natural_language.dsl_keywords.each do |key, values|
    values.map { |value| alias_method value, key }
  end
end

#translate_share_as_keywordsObject

Translate adverbs for the share_as keywords

{ ‘share_as’ => [‘distribua’, ‘distribua_como’]}



31
32
33
34
35
# File 'lib/spec-i18n/dsl/main.rb', line 31

def translate_share_as_keywords
  natural_language.share_as_keywords.each do |share_as_method, share_as_keywords|
    share_as_keywords.each { |keyword| alias_method keyword, share_as_method }
  end
end

#translate_shared_examples_forObject

Translate adverbs for the shared_examples_for keyword

{ “shared_examples_for” => [‘exemplos_distribuidos_para’]}



21
22
23
24
25
# File 'lib/spec-i18n/dsl/main.rb', line 21

def translate_shared_examples_for
  natural_language.shared_examples_for_keywords.each do |shared_examples_method, shared_example_keywords|
    shared_example_keywords.each { |keyword| alias_method keyword, shared_examples_method }
  end
end