Class: Microsandbox::SandboxPage
- Inherits:
-
Object
- Object
- Microsandbox::SandboxPage
- Includes:
- Enumerable
- Defined in:
- lib/microsandbox/sandbox.rb
Overview
One page of sandbox handles, returned by Microsandbox::Sandbox.list and Microsandbox::Sandbox.list_with — sandbox listing is cursor-paginated as of runtime v0.6.8. Enumerable over its SandboxHandles; fetch the following page by passing #next_cursor to Microsandbox::Sandbox.list_with.
Instance Attribute Summary collapse
-
#next_cursor ⇒ String?
readonly
Opaque cursor for the next page; nil on the final page.
-
#sandboxes ⇒ Array<SandboxHandle>
readonly
The sandboxes in this page.
Instance Method Summary collapse
- #each ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(sandboxes, next_cursor) ⇒ SandboxPage
constructor
A new instance of SandboxPage.
- #inspect ⇒ Object
-
#last_page? ⇒ Boolean
Whether this is the final page (no cursor to continue from).
- #size ⇒ Integer (also: #length)
Constructor Details
#initialize(sandboxes, next_cursor) ⇒ SandboxPage
Returns a new instance of SandboxPage.
226 227 228 229 |
# File 'lib/microsandbox/sandbox.rb', line 226 def initialize(sandboxes, next_cursor) @sandboxes = sandboxes @next_cursor = next_cursor end |
Instance Attribute Details
#next_cursor ⇒ String? (readonly)
Returns opaque cursor for the next page; nil on the final page.
223 224 225 |
# File 'lib/microsandbox/sandbox.rb', line 223 def next_cursor @next_cursor end |
#sandboxes ⇒ Array<SandboxHandle> (readonly)
Returns the sandboxes in this page.
221 222 223 |
# File 'lib/microsandbox/sandbox.rb', line 221 def sandboxes @sandboxes end |
Instance Method Details
#each ⇒ Object
231 |
# File 'lib/microsandbox/sandbox.rb', line 231 def each(&) = @sandboxes.each(&) |
#empty? ⇒ Boolean
237 |
# File 'lib/microsandbox/sandbox.rb', line 237 def empty? = @sandboxes.empty? |
#inspect ⇒ Object
242 243 244 |
# File 'lib/microsandbox/sandbox.rb', line 242 def inspect "#<Microsandbox::SandboxPage size=#{size} next_cursor=#{@next_cursor.inspect}>" end |
#last_page? ⇒ Boolean
Whether this is the final page (no cursor to continue from).
240 |
# File 'lib/microsandbox/sandbox.rb', line 240 def last_page? = @next_cursor.nil? |
#size ⇒ Integer Also known as: length
234 |
# File 'lib/microsandbox/sandbox.rb', line 234 def size = @sandboxes.size |