class Glosbe::Result

Attributes

authors[R]
language[R]
meanings[R]
phrase[R]

Public Class Methods

new(data, authors: []) click to toggle source
# File lib/glosbe/result.rb, line 5
def initialize(data, authors: [])
  if data["phrase"]
    @phrase = data["phrase"]["text"]
    @language = data["phrase"]["language"]
  end
  @authors = authors.select do |author|
    data["authors"].include?(author.id)
  end
  @meanings = (data["meanings"] || []).map { |meaning| Glosbe::Meaning.new(meaning) }
end