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
dguettler-god-0.7.13.2 lib/god/timeline.rb
dguettler-god-0.7.13.3 lib/god/timeline.rb
dosire-god-0.7.10 lib/god/timeline.rb
dosire-god-0.7.12 lib/god/timeline.rb
dosire-god-0.7.9 lib/god/timeline.rb
dunedain289-god-0.7.12.1 lib/god/timeline.rb
dustin-god-0.7.7.1 lib/god/timeline.rb
eric-god-0.7.10 lib/god/timeline.rb
eric-god-0.7.11 lib/god/timeline.rb
eric-god-0.7.12 lib/god/timeline.rb
eric-god-0.7.14 lib/god/timeline.rb
eric-god-0.7.7 lib/god/timeline.rb
fotonauts-god-0.7.10 lib/god/timeline.rb
fotonauts-god-0.7.12 lib/god/timeline.rb
gohanlonllc-god-0.7.9 lib/god/timeline.rb
gordoncww-god-0.7.11.1 lib/god/timeline.rb
jreynolds-god-0.7.13 lib/god/timeline.rb
jwilkins-god-0.7.9 lib/god/timeline.rb
mathieuravaux-god-0.7.11 lib/god/timeline.rb
mojombo-god-0.7.10 lib/god/timeline.rb