Module: Pixmatch::Client::Count
- Included in:
- Pixmatch::Client
- Defined in:
- lib/pixmatch/client/count.rb
Instance Method Summary collapse
-
#count ⇒ Object
Get the number of items currently in the collection.
Instance Method Details
#count ⇒ Object
Get the number of items currently in the collection.
6 7 8 9 10 11 12 13 |
# File 'lib/pixmatch/client/count.rb', line 6 def count response = request(:get, 'rest', { method: :count }) result = response['result'] raise "Missing result in response." if result.nil? raise "Invalid result in response (#{result.class.name})." if ! result.is_a?(Array) raise "Invalid count in result response (#{result.size})." if result.size != 1 result[0].to_i end |