Sha256: 86b9ee1b2c70d2cadbccc7586af48071241ca0476b62218910d507caf070776a

Contents?: true

Size: 689 Bytes

Versions: 1

Compression:

Stored size: 689 Bytes

Contents

class Dancer
  # Create an unbounded timeslice
  def self.unbounded(step)
    new(nil, nil, step)
  end

  # Create a timeslice from a range
  def self.range(range, step)
    new(range.begin, range.end, step, range.exclude_end?)
  end

  # Create a timeslice from a start time and a number of a points
  def self.extent(start_at, size, step, exclude_end = false)
    end_at = start_at + (step * size) - 1

    new(start_at, end_at, step, exclude_end)
  end

  # Create a timeslice from a list of start times
  def self.keys(keys, step, exclude_end = false)
    start_at = keys.min
    end_at = keys.max ? (keys.max + step - 1) : nil

    new(start_at, end_at, step, exclude_end)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dancer-0.1.0 lib/dancer/factories.rb