Sha256: 0f8e253c6f3be1ebff659eddbeaf42d16269d49622f5ba8ef94529b121d634e9

Contents?: true

Size: 904 Bytes

Versions: 99

Compression:

Stored size: 904 Bytes

Contents

class FyipeTimelineManager
    def initialize(options)
        @options = options
        @timeLineStack = []
    end


    def addToTimeline(item)
        addItemToTimeline(item)
    end
    
    # return the timeline
    def getTimeline()
        return @timeLineStack
    end
    
    # clear the timeline
    def clearTimeline()
        @timeLineStack = []
    end 

   
    private
    def addItemToTimeline(item)
        # get the size of the stack
        if (@options[:maxTimeline] != nil && (@timeLineStack.length() == @options[:maxTimeline].to_i))
            return # It discards new timeline update once maximum is reached
        end

        # add time to it
        # current date and time
        time = Time.now
        now = time.inspect

        item["timestamp"] = now
        
        # add a new item to the stack
        @timeLineStack.append(item)
        return true
    end
end 

Version data entries

99 entries across 99 versions & 1 rubygems

Version Path
fyipe-3.0.14476.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14419.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14400.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14394.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14342.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14281.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14267.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14235.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14233.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14202.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14151.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14140.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14114.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14104.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14102.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14100.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14089.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14087.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14054.pre.qa lib/fyipe/timelineManager.rb
fyipe-3.0.14051.pre.qa lib/fyipe/timelineManager.rb