Class: NoteMeta

Inherits:
Object
  • Object
show all
Defined in:
lib/yinx/note_meta.rb

Instance Method Summary collapse

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 meta, note_store
  @meta = meta
  @store = note_store
end

Instance Method Details

#bookObject



26
27
28
# File 'lib/yinx/note_meta.rb', line 26

def book
  @book ||= @store.book_name notebookGuid
end

#marshal_dumpObject



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

#stackObject



30
31
32
# File 'lib/yinx/note_meta.rb', line 30

def stack
  @stack = (instance_variable_defined? :@stack) ? @stack : @store.stack_name(notebookGuid)
end

#tagsObject



22
23
24
# File 'lib/yinx/note_meta.rb', line 22

def tags
  @tags ||= (tagGuids ? tagGuids.map{|id| @store.tag_name id} : [])
end

#to_hObject



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