Class: Yinx::NoteMeta
- Inherits:
-
Object
- Object
- Yinx::NoteMeta
- Defined in:
- lib/yinx_st/note_meta.rb
Instance Attribute Summary collapse
-
#batches ⇒ Object
Returns the value of attribute batches.
-
#dump_at ⇒ Object
Returns the value of attribute dump_at.
-
#dump_id ⇒ Object
Returns the value of attribute dump_id.
Instance Method Summary collapse
- #changed_tags? ⇒ Boolean
- #created_today? ⇒ Boolean
- #deleted_today? ⇒ Boolean
- #dump_day ⇒ Object
- #moved_book? ⇒ Boolean
- #prev_version ⇒ Object
- #stack_book ⇒ Object
- #stack_name ⇒ Object
- #status ⇒ Object
- #tags_count ⇒ Object
- #updated_today? ⇒ Boolean
Instance Attribute Details
#batches ⇒ Object
Returns the value of attribute batches.
4 5 6 |
# File 'lib/yinx_st/note_meta.rb', line 4 def batches @batches end |
#dump_at ⇒ Object
Returns the value of attribute dump_at.
4 5 6 |
# File 'lib/yinx_st/note_meta.rb', line 4 def dump_at @dump_at end |
#dump_id ⇒ Object
Returns the value of attribute dump_id.
4 5 6 |
# File 'lib/yinx_st/note_meta.rb', line 4 def dump_id @dump_id end |
Instance Method Details
#changed_tags? ⇒ Boolean
37 38 39 |
# File 'lib/yinx_st/note_meta.rb', line 37 def prev_version and prev_version..sort != self..sort end |
#created_today? ⇒ Boolean
14 15 16 |
# File 'lib/yinx_st/note_meta.rb', line 14 def created_today? created_at.between? (dump_at - 1.day), dump_at end |
#deleted_today? ⇒ Boolean
18 19 20 |
# File 'lib/yinx_st/note_meta.rb', line 18 def deleted_today? batches.of_guid(guid).first == self and dump_id != batches.latest_id end |
#dump_day ⇒ Object
6 7 8 |
# File 'lib/yinx_st/note_meta.rb', line 6 def dump_day dump_at.strftime '%y/%m/%d %a' end |
#moved_book? ⇒ Boolean
33 34 35 |
# File 'lib/yinx_st/note_meta.rb', line 33 def moved_book? prev_version and (prev_version.book != self.book or prev_version.stack != self.stack) end |
#prev_version ⇒ Object
29 30 31 |
# File 'lib/yinx_st/note_meta.rb', line 29 def prev_version @prev_version ||= batches.of_guid(guid).bsearch{|version| version.dump_id < self.dump_id} end |
#stack_book ⇒ Object
41 42 43 44 |
# File 'lib/yinx_st/note_meta.rb', line 41 def stack_book st = stack.nil? ? '' : "#{stack}/" "#{st}#{book}" end |
#stack_name ⇒ Object
46 47 48 |
# File 'lib/yinx_st/note_meta.rb', line 46 def stack_name stack ? stack : 'No Stack' end |
#status ⇒ Object
22 23 24 25 26 27 |
# File 'lib/yinx_st/note_meta.rb', line 22 def status return :created if created_today? return :updated if updated_today? return :deleted if deleted_today? :remained end |
#tags_count ⇒ Object
50 51 52 |
# File 'lib/yinx_st/note_meta.rb', line 50 def .count end |
#updated_today? ⇒ Boolean
10 11 12 |
# File 'lib/yinx_st/note_meta.rb', line 10 def updated_today? updated_at.between? (dump_at - 1.day), dump_at end |