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
- #dump_day ⇒ Object
- #moved_book? ⇒ Boolean
- #prev_version ⇒ Object
- #status ⇒ 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
32 33 34 |
# File 'lib/yinx_st/note_meta.rb', line 32 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 |
#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
28 29 30 |
# File 'lib/yinx_st/note_meta.rb', line 28 def moved_book? prev_version and (prev_version.book != self.book or prev_version.stack != self.stack) end |
#prev_version ⇒ Object
24 25 26 |
# File 'lib/yinx_st/note_meta.rb', line 24 def prev_version @prev_version ||= batches.of_guid(guid).bsearch{|version| version.dump_id < self.dump_id} end |
#status ⇒ Object
18 19 20 21 22 |
# File 'lib/yinx_st/note_meta.rb', line 18 def status return :created if created_today? return :updated if updated_today? :remained 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 |