Ocarina of Time
Play this song near a blue Time Block.
------------------------------------------------
-( > )---------( > )----------------------------
----------( v )-----------( > )-----------------
-----( A )-----------( A )----------------------
Installation
$ gem install ocarina_of_time
Usage
I'm still sort of fleshing out some things. So, I'll update thing as they change.
require 'ocarina_of_time'
timeline = OcarinaOfTime::Timeline.new
timeline.beginning
timeline.beginning?
timeline.ending
timeline.ending?
timeline.ending(Time.now)
timeline.ending?
timeline.ending
timeline.flex!
Timeline
A timeline is a way of displaying a list of events in chronological order, sometimes described as a project artifact ( an event ). Timelines can use any time scale, depending on the subject and data. Most timelines use a linear scale, where a unit of distance is equal to a set amount of time. Or, well, at least that is what Wikipedia says.
The Short and Simple
A timeline has a beginning ( sometimes ) and an ending ( sometimes ). You can have a flexible timeline where, as events are added, the beginning and ending points in time will be determined by the actual events themselve.
timeline.events.add(label: "Example 1")
timeline.events.delete(id: "e41fdc5c-6a8d-4d85-addb-27b6f81666e9")
timeline.events.delete(id: "e41fdc5c-6a8d-4d85-addb-27b6f81666e9")
Events
Timelines events are stored in an events class which acts as a nice wrapped to our timeline Event objects.
timeline = OcarinaOfTime::Line.new
timeline.events.add(label: "Example 1")
timeline.events.add(label: "Example 2")
timeline.events.update(id: "2f6716b1-9a2f-46d2-8bcf-4db0212032f1", value: 1)
timelines.events.delete(id: "2f6716b1-9a2f-46d2-8bcf-4db0212032f1")
timeline.events.by(oldest: true)
timeline.events.by(newest: true)
timeline.events.find(label: "Example 1")
timeline.events.find(labels: ["Example 1", "Example 2"])
timeline.events.find(event: timeline.events.all.first)
timeline.events.find(date: Time.now.to_date)
timeline.events.find(date: Time.now.to_date).find(label: "Example 1")
timeline.events.dates
timeline.events.times
timelines.events.labels
timelines.events.ids
timelines.events.tags
timelines.events.tags(unique: false)
timelines.events.times(unique: false)
Event
Timeline Events are made up of serveral Event objects. An event object is made up of its unique ID number,
its label, its tags ( as a set, unique ), the time of the event ( default to its creation time ), the time
the event was created ( defaults to its creation time ) and a value -- which can be whatever you like, if you
want to use that ( instead of just stuffing that data in tags ).
event = OcarinaOfTime::Event.new
event.label
event.data.label = "Example 1"
event.label
event.tags?
tags = ["Cool", "Sick", "Awesome"]
tag = "Gnarly"
event.add_tags(tags)
event.add_tags(tag)
event.tags?
event.tags
timeline1 = OcarinaOfTime::Line.new
timeline2 = OcarinaOfTime::Line.new
timeline1.events.add(event: event)
timeline2.events.add(event: event)
License
The gem is available as open source under the terms of the MIT License.