Class: ThatLanguage::Client::AvailableQuery

Inherits:
Query
  • Object
show all
Defined in:
lib/that_language/client/available_query.rb

Instance Attribute Summary

Attributes inherited from Query

#text

Instance Method Summary collapse

Methods inherited from Query

#to_h

Constructor Details

#initialize(client: Client.current) ⇒ AvailableQuery

FIXME: do not pass text to super



7
8
9
# File 'lib/that_language/client/available_query.rb', line 7

def initialize(client: Client.current)
  super(text: "", client: client)
end

Instance Method Details

#availableObject

The exception to the rule in Query#language_name: this hash is keyed by symbol in the core gem ({ak: :Akan}), so the code is a symbol here even though language_code(text) returns a string.



14
15
16
# File 'lib/that_language/client/available_query.rb', line 14

def available
  @available ||= json["available"].to_h { |code, name| [code.to_sym, language_name(name)] }
end