Sha256: 886820a72f9d58b7a17b8e336a6daa8dec568b36760b3c8c230839c66e14bc94

Contents?: true

Size: 486 Bytes

Versions: 67

Compression:

Stored size: 486 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

67 entries across 67 versions & 21 rubygems

Version Path
god-0.9.0 lib/god/timeline.rb
olgen-god-0.9.2 lib/god/timeline.rb
olgen-god-0.9.1 lib/god/timeline.rb
olgen-god-0.9.0 lib/god/timeline.rb
god-0.8.0 lib/god/timeline.rb
olgen-god-0.8.2 lib/god/timeline.rb
olgen-god-0.8.1 lib/god/timeline.rb
olgen-god-0.8.0 lib/god/timeline.rb
god-0.7.22 lib/god/timeline.rb
god-0.7.21 lib/god/timeline.rb
god-0.7.20 lib/god/timeline.rb
god-0.7.19 lib/god/timeline.rb
god-0.7.18 lib/god/timeline.rb
god-0.7.17 lib/god/timeline.rb
god-0.7.16 lib/god/timeline.rb
god-0.7.15 lib/god/timeline.rb
god-0.7.14 lib/god/timeline.rb
god-0.7.0 lib/god/timeline.rb
god-0.7.11 lib/god/timeline.rb
god-0.7.10 lib/god/timeline.rb