class FyipeTimelineManager
Public Class Methods
new(options)
click to toggle source
# File lib/fyipe/timelineManager.rb, line 2 def initialize(options) @options = options @timeLineStack = [] end
Public Instance Methods
addToTimeline(item)
click to toggle source
# File lib/fyipe/timelineManager.rb, line 8 def addToTimeline(item) addItemToTimeline(item) end
clearTimeline()
click to toggle source
clear the timeline
# File lib/fyipe/timelineManager.rb, line 18 def clearTimeline() @timeLineStack = [] end
getTimeline()
click to toggle source
return the timeline
# File lib/fyipe/timelineManager.rb, line 13 def getTimeline() return @timeLineStack end
Private Instance Methods
addItemToTimeline(item)
click to toggle source
# File lib/fyipe/timelineManager.rb, line 24 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