Class: SyllabsApi::Modules::Terms::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/syllabs-api/modules/terms/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Response

Returns a new instance of Response.



9
10
11
12
13
14
15
16
# File 'lib/syllabs-api/modules/terms/response.rb', line 9

def initialize(json)
  @terms = []
  json['response']['terms'].each do |t|
    @terms << Term.new(t['text'], t['lemma'])
  end
rescue Exception => e
  raise e
end

Instance Attribute Details

#termsObject (readonly)

Returns the value of attribute terms.



7
8
9
# File 'lib/syllabs-api/modules/terms/response.rb', line 7

def terms
  @terms
end