Class: Evertils::Common::Manager::Notebook

Inherits:
Base
  • Object
show all
Includes:
Singleton
Defined in:
lib/evertils/common/manager/notebook.rb

Overview

Since:

  • 0.3.0

Instance Method Summary collapse

Methods inherited from Generic

#bytesize, #deprecation_notice, #encoding, #force_encoding, #has_required_fields, #initialize

Constructor Details

This class inherits a constructor from Evertils::Common::Generic

Instance Method Details

#create(name, stack = nil) ⇒ Object

Since:

  • 0.3.0



11
12
13
14
15
# File 'lib/evertils/common/manager/notebook.rb', line 11

def create(name, stack = nil)
  entity = Evertils::Common::Entity::Notebook.new
  entity.create(name, stack)
  entity
end

#find(name) ⇒ Object

Since:

  • 0.3.0



19
20
21
22
23
# File 'lib/evertils/common/manager/notebook.rb', line 19

def find(name)
  entity = Evertils::Common::Entity::Notebook.new
  entity.find(name)
  entity
end

#find_or_create(name, stack = nil) ⇒ Object

Since:

  • 0.3.0



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/evertils/common/manager/notebook.rb', line 27

def find_or_create(name, stack = nil)
  search_result = find(name)

  if !search_result
    note = create(name, stack)
  else
    note = search_result
  end

  note
end