Class: Oversetter::Hablaa::Getlangs

Inherits:
Object
  • Object
show all
Defined in:
lib/oversetter/hablaa/getlangs.rb

Overview

Fetches supported languages from Hablaa.

Instance Method Summary collapse

Instance Method Details

#get_lang(search, params) ⇒ Object

Parameters:

  • params (Hash)

    The search parameters to use.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/oversetter/hablaa/getlangs.rb', line 10

def get_lang(search, params)
  func, result = 'languages', nil
  lang = Oversetter::Hablaa.new
  result = lang.get_word(search, func, params, result)
  result = MultiJson.load(result) #array of hashes
  label = 'Languages'
  Oversetter.label(label)
  puts ''
  x, y = 0, result.length - 1
  while x <= y
    item = result[x]
    print Rainbow('Name|').bright
    print "#{item['name']}|"
    print Rainbow('Code|').bright
    print "#{item['lang_code']}|"
    print Rainbow('Site Language?|').bright
    if item['site_language'] == '1' then print 'yes' else print 'no'; end
    puts ''
    x += 1
  end
end