Class: Dmm::Result

Inherits:
Base
  • Object
show all
Defined in:
lib/dmm/result.rb

Instance Method Summary collapse

Methods inherited from Base

attr_reader, #initialize

Constructor Details

This class inherits a constructor from Dmm::Base

Instance Method Details

#first_positionInteger

Returns a position of first item

Returns:

  • (Integer)


24
25
26
# File 'lib/dmm/result.rb', line 24

def first_position
  @attrs[:first_position].to_i
end

#itemsArray<Dmm::Item>

Returns a array containing Dmm::Item object

Returns:



31
32
33
34
35
36
# File 'lib/dmm/result.rb', line 31

def items
  return [] unless @attrs[:items]
  item_list = @attrs[:items][:item]
  item_list = [item_list] if item_list.kind_of? Hash
  item_list.map! { |item| Dmm::Item.new(item) }
end

#result_countInteger

Returns a count of result data

Returns:

  • (Integer)


10
11
12
# File 'lib/dmm/result.rb', line 10

def result_count
  @attrs[:result_count].to_i
end

#total_countInteger

Returns a count of total data

Returns:

  • (Integer)


17
18
19
# File 'lib/dmm/result.rb', line 17

def total_count
  @attrs[:total_count].to_i
end