Sha256: 6364b3ac7a7ebff960aa2d74eea8d5c8c2a19ff8c337efc50a24e3ad570f5f5b

Contents?: true

Size: 481 Bytes

Versions: 1

Compression:

Stored size: 481 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)
      super
      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.1 lib/god/timeline.rb