Class: DictClient::WordMatch

Inherits:
SimpleResponse show all
Includes:
Formattable
Defined in:
lib/dict_client/responses.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Formattable

#longest, #print_formatted

Methods inherited from SimpleResponse

#initialize

Constructor Details

This class inherits a constructor from DictClient::SimpleResponse

Instance Attribute Details

#matchesObject (readonly)

Returns the value of attribute matches.



84
85
86
# File 'lib/dict_client/responses.rb', line 84

def matches
  @matches
end

Instance Method Details

#countObject



93
94
95
# File 'lib/dict_client/responses.rb', line 93

def count
  @matches.size
end

#to_sObject



86
87
88
89
90
91
# File 'lib/dict_client/responses.rb', line 86

def to_s
  max_key   = longest @matches.map{|tuple| tuple[0] }
  max_value = longest @matches.map{|tuple| tuple[1] }

  print_formatted @matches, max_key, max_value
end