Class: CloudSesame::Query::Node::Page

Inherits:
Abstract
  • Object
show all
Defined in:
lib/cloud_sesame/query/node/page.rb

Instance Attribute Summary collapse

Attributes inherited from Abstract

#context

Instance Method Summary collapse

Methods inherited from Abstract

#initialize

Constructor Details

This class inherits a constructor from CloudSesame::Query::Node::Abstract

Instance Attribute Details

#pageObject



8
9
10
# File 'lib/cloud_sesame/query/node/page.rb', line 8

def page
          @page ||= context[:page] || 1
end

#sizeObject



12
13
14
# File 'lib/cloud_sesame/query/node/page.rb', line 12

def size
  @size ||= context[:size] || 10
end

#startObject



16
17
18
# File 'lib/cloud_sesame/query/node/page.rb', line 16

def start
  @start ||= (page - 1) * size
end

Instance Method Details

#compileObject



20
21
22
# File 'lib/cloud_sesame/query/node/page.rb', line 20

def compile
  { start: start, size: size }
end