Class: NoteMeta
- Inherits:
-
Object
- Object
- NoteMeta
- Defined in:
- lib/yinx/note_meta.rb
Instance Method Summary collapse
- #book ⇒ Object
-
#initialize(meta, note_store) ⇒ NoteMeta
constructor
A new instance of NoteMeta.
- #marshal_dump ⇒ Object
- #marshal_load(hash) ⇒ Object
- #stack ⇒ Object
- #tags ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(meta, note_store) ⇒ NoteMeta
Returns a new instance of NoteMeta.
17 18 19 20 |
# File 'lib/yinx/note_meta.rb', line 17 def initialize , note_store @meta = @store = note_store end |
Instance Method Details
#book ⇒ Object
26 27 28 |
# File 'lib/yinx/note_meta.rb', line 26 def book @book ||= @store.book_name notebookGuid end |
#marshal_dump ⇒ Object
40 41 42 |
# File 'lib/yinx/note_meta.rb', line 40 def marshal_dump to_h end |
#marshal_load(hash) ⇒ Object
44 45 46 47 48 |
# File 'lib/yinx/note_meta.rb', line 44 def marshal_load hash hash.each do |key, value| instance_variable_set "@#{key}", value end end |
#stack ⇒ Object
30 31 32 |
# File 'lib/yinx/note_meta.rb', line 30 def stack @stack = (instance_variable_defined? :@stack) ? @stack : @store.stack_name(notebookGuid) end |
#tags ⇒ Object
22 23 24 |
# File 'lib/yinx/note_meta.rb', line 22 def @tags ||= (tagGuids ? tagGuids.map{|id| @store.tag_name id} : []) end |
#to_h ⇒ Object
34 35 36 37 38 |
# File 'lib/yinx/note_meta.rb', line 34 def to_h @h = attr_methods.each_with_object({}) do |method, hash| hash[method] = send method end end |