Sha256: 07948ca798c4d9c2c7f9103b3e381cd683348fd638f89c443f9ccba29b84362b

Contents?: true

Size: 485 Bytes

Versions: 2

Compression:

Stored size: 485 Bytes

Contents

# This class is responsible for translating "hello world" based on the
# given language
class GemTutorial::Translator
  # Initialize translator with language
  #
  # @param language [String] the language
  def initialize(language)
    @language = language
  end

  # Print 'hello world' depending on the class language passed in
  #
  # @return [nil] Prints 'hello world'.
  def hi
    case @language
    when 'spanish'
      'hola mundo'
    else
      'hello world'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gem_tutorial_kcheung-0.0.3 lib/gem_tutorial_kcheung/translator.rb
gem_tutorial_kcheung-0.0.2 lib/gem_tutorial_kcheung/translator.rb