Class: Tlog::Entity::Entry
- Inherits:
-
Object
- Object
- Tlog::Entity::Entry
- Defined in:
- lib/tlog/entity/entry.rb
Instance Attribute Summary collapse
-
#hex ⇒ Object
Returns the value of attribute hex.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #create(parent, current) ⇒ Object
- #description ⇒ Object
-
#initialize(path, hex) ⇒ Entry
constructor
A new instance of Entry.
- #length ⇒ Object
- #owner ⇒ Object
- #parent_hex ⇒ Object
- #time ⇒ Object
Constructor Details
#initialize(path, hex) ⇒ Entry
Returns a new instance of Entry.
7 8 9 10 |
# File 'lib/tlog/entity/entry.rb', line 7 def initialize(path, hex) @path = path @hex = hex end |
Instance Attribute Details
#hex ⇒ Object
Returns the value of attribute hex.
4 5 6 |
# File 'lib/tlog/entity/entry.rb', line 4 def hex @hex end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/tlog/entity/entry.rb', line 5 def path @path end |
Instance Method Details
#create(parent, current) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/tlog/entity/entry.rb', line 16 def create(parent, current) FileUtils.mkdir_p(path) time_log = current[:start_time].to_s + " " + Time.now.to_s write_file(parent_path, parent) write_file(time_path, time_log.strip) write_file(description_path, current[:description]) write_file(owner_path, current[:owner]) end |
#description ⇒ Object
47 48 49 |
# File 'lib/tlog/entity/entry.rb', line 47 def description read_file(description_path) end |
#length ⇒ Object
12 13 14 |
# File 'lib/tlog/entity/entry.rb', line 12 def length time_difference if time[:start] && time[:end] end |
#owner ⇒ Object
51 52 53 |
# File 'lib/tlog/entity/entry.rb', line 51 def owner read_file(owner_path) end |
#parent_hex ⇒ Object
25 26 27 |
# File 'lib/tlog/entity/entry.rb', line 25 def parent_hex read_file(parent_path) end |
#time ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/tlog/entity/entry.rb', line 29 def time time_hash = {} start_time_string = "" end_time_string = "" time_contents = read_file(time_path) return time_hash unless time_contents split_contents = time_contents.split(" ", 6) for i in 0..2 start_time_string += split_contents[i] + " " end for i in 3..5 end_time_string += split_contents[i] + " " end time_hash[:start] = Time.parse(start_time_string) time_hash[:end] = Time.parse(end_time_string) return time_hash end |