Sha256: a7342171a80d28a7cd1ec25222719d63ede41ad7b2e326156eaa5a2b9ba6139f

Contents?: true

Size: 980 Bytes

Versions: 11

Compression:

Stored size: 980 Bytes

Contents

module CloudSesame
	module Query
		module DSL
			module PageMethods

				# CLAUSE: PAGE and SIZE
				# =========================================
				def cursor(input = false)
					if input != false
						request.page.cursor = input
						return self
					else
						request.page.cursor
					end
				end

				def page(input = false)
					if input || input.nil?
						request.page.start = nil
						request.page.page = (input || 1).to_i
						return self
					else
						request.page.page
					end
				end

				def start(input = false)
					if input || input.nil?
						request.page.page = nil
						request.page.start = input.to_i
						return self
					else
						request.page.start
					end
				end

				alias_method :offset,  :start

				def size(input = false)
					if input
						request.page.size = input.to_i
						return self
					elsif input.nil?
						return self
					else
						request.page.size
					end
				end

				alias_method :limit,  :size

			end
		end
	end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
CloudSesame-1.0.1 lib/cloud_sesame/query/dsl/page_methods.rb
CloudSesame-1.0.0 lib/cloud_sesame/query/dsl/page_methods.rb
CloudSesame-0.9.4 lib/cloud_sesame/query/dsl/page_methods.rb
CloudSesame-0.9.3 lib/cloud_sesame/query/dsl/page_methods.rb
CloudSesame-0.9.2 lib/cloud_sesame/query/dsl/page_methods.rb
CloudSesame-0.9.1 lib/cloud_sesame/query/dsl/page_methods.rb
CloudSesame-0.9.0 lib/cloud_sesame/query/dsl/page_methods.rb
CloudSesame-0.8.3 lib/cloud_sesame/query/dsl/page_methods.rb
CloudSesame-0.8.2 lib/cloud_sesame/query/dsl/page_methods.rb
CloudSesame-0.8.1 lib/cloud_sesame/query/dsl/page_methods.rb
CloudSesame-0.8.0 lib/cloud_sesame/query/dsl/page_methods.rb