class RRRMatey::DiscreteResult

Attributes

discrete_length[R]
length[R]
offset[R]
results[R]

Public Class Methods

new(opts = {}) click to toggle source
# File lib/rrrmatey/discrete_result.rb, line 5
def initialize(opts = {})
    @results = opts[:results].to_a
    @length = opts[:length]
    @offset = opts[:offset]
    @discrete_length = opts[:discrete_length]
end

Public Instance Methods

to_json(opts = {}) click to toggle source
# File lib/rrrmatey/discrete_result.rb, line 12
def to_json(opts = {})
    to_consumer_hash.to_json
end
to_xml(opts = {}) click to toggle source
# File lib/rrrmatey/discrete_result.rb, line 16
def to_xml(opts = {})
    to_consumer_hash.to_xml
end

Private Instance Methods

to_consumer_hash() click to toggle source
# File lib/rrrmatey/discrete_result.rb, line 22
def to_consumer_hash
    {
        :length => length,
        :offset => offset,
        :limit => discrete_length,
        :results => results.map { |it| it.send(:to_consumer_hash) }
    }
end