Sha256: 306f9a6b120f3daa4dc8baed68abd90c60a00a913c2e9734b02b4f336dbd42a0

Contents?: true

Size: 475 Bytes

Versions: 12

Compression:

Stored size: 475 Bytes

Contents

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)
      self.concat([val])
      shift if size > @max_size
    end

    alias_method :<<, :push
  end

end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
resurrected_god-0.14.0 lib/god/timeline.rb
mcproc-2016.2.20 lib/god/timeline.rb
god-0.13.7 lib/god/timeline.rb
god-0.13.6 lib/god/timeline.rb
god-0.13.5 lib/god/timeline.rb
god-0.13.4 lib/god/timeline.rb
god-0.13.3 lib/god/timeline.rb
god-0.13.2 lib/god/timeline.rb
god-0.13.1 lib/god/timeline.rb
god-0.13.0 lib/god/timeline.rb
god-0.12.1 lib/god/timeline.rb
god-0.12.0 lib/god/timeline.rb