class Airspace::Metadata

Metdata is 'data about a dataset.' These are key pieces of information we need to store with the data then later retrieve with the data.

Constants

DEFAULT_PAGES_PER_CHUNK

Attributes

expires_in_seconds[R]
page_count[R]
pages_per_chunk[R]

Public Class Methods

new(expires_in_seconds: nil, page_count: 0, pages_per_chunk: DEFAULT_PAGES_PER_CHUNK) click to toggle source
# File lib/airspace/metadata.rb, line 20
def initialize(expires_in_seconds: nil, page_count: 0, pages_per_chunk: DEFAULT_PAGES_PER_CHUNK)
  @expires_in_seconds = expires_in_seconds ? expires_in_seconds.to_i : nil
  @page_count         = page_count.to_i
  @pages_per_chunk    = pages_per_chunk ? pages_per_chunk.to_i : DEFAULT_PAGES_PER_CHUNK

  freeze
end

Public Instance Methods

chunk_count() click to toggle source
# File lib/airspace/metadata.rb, line 32
def chunk_count
  chunker.count(page_count)
end
chunker() click to toggle source
# File lib/airspace/metadata.rb, line 28
def chunker
  ::Airspace::Chunker.new(pages_per_chunk)
end
to_json() click to toggle source
# File lib/airspace/metadata.rb, line 36
def to_json
  {
    expires_in_seconds: expires_in_seconds,
    page_count: page_count,
    pages_per_chunk: pages_per_chunk
  }.to_json
end