Class: Currently::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/currently/entry.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, contexts = [], ts = Time.now.to_s) ⇒ Entry

Returns a new instance of Entry.



3
4
5
6
7
# File 'lib/currently/entry.rb', line 3

def initialize(text,contexts = [],ts = Time.now.to_s)
  @text = text
  @contexts = contexts
  @timestamp = ts
end

Instance Method Details

#serialize_to_lineObject

put this into sep module?



14
15
16
# File 'lib/currently/entry.rb', line 14

def serialize_to_line
  @timestamp.to_s + "| " + @text + " " + @contexts.map{|x| "#" + x}.join(" ")
end

#to_sObject



9
10
11
# File 'lib/currently/entry.rb', line 9

def to_s
  @text + @contexts.map{|x| "#" + x}.join(" ")
end