Sha256: 036bda5aa6ca3f5e9ec8e4f0f3cf9551534459822bf178ebf04f732291eb1233

Contents?: true

Size: 664 Bytes

Versions: 2

Compression:

Stored size: 664 Bytes

Contents

module Freakin #:nodoc:
  # An instance of +Translator+ will determine what greeting to return based
  # on the language selected when its instantiated
  class Translator
    # Instantiate a new instance of Translator for a chosen language
    #
    # ==== Examples
    #
    #   Freakin::Translator.new('spanish')
    #
    def initialize(language)
      @language = language
    end

    # Call to return a greeting
    # ==== Examples
    #
    #   foo = Freakin::Translator.new('spanish')
    #   foo.hi # 'hola mundo'
    #
    def hi
      case @language
      when 'spanish'
        'hola mundo'
      else
        'hello world'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
freakin-0.1.1 lib/freakin/translator.rb
freakin-0.1.0 lib/freakin/translator.rb