Sha256: da764f98eb75c053e77a533f9aaf17d0e6a11edb34274b060867ed455df1e69f

Contents?: true

Size: 489 Bytes

Versions: 1

Compression:

Stored size: 489 Bytes

Contents

# frozen_string_literal: true

module God
  class Timeline < Array
    # Instantiate a new Timeline
    #   +max_size+ is the maximum size to which the timeline should grow
    #
    # Returns Timeline
    def initialize(max_size)
      super()
      @max_size = max_size
    end

    # Push a value onto the Timeline
    #   +val+ is the value to push
    #
    # Returns Timeline
    def push(val)
      concat([val])
      shift if size > @max_size
    end

    alias << push
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resurrected_god-1.1.0 lib/god/timeline.rb