Class: Docs::PageDb

Inherits:
Object
  • Object
show all
Defined in:
lib/docs/core/page_db.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePageDb

Returns a new instance of PageDb


9
10
11
# File 'lib/docs/core/page_db.rb', line 9

def initialize
  @pages = {}
end

Instance Attribute Details

#pagesObject (readonly)

Returns the value of attribute pages


5
6
7
# File 'lib/docs/core/page_db.rb', line 5

def pages
  @pages
end

Instance Method Details

#add(path, content) ⇒ Object


13
14
15
# File 'lib/docs/core/page_db.rb', line 13

def add(path, content)
  @pages[path] = content
end

#as_jsonObject


17
18
19
# File 'lib/docs/core/page_db.rb', line 17

def as_json
  @pages
end

#to_jsonObject


21
22
23
# File 'lib/docs/core/page_db.rb', line 21

def to_json
  JSON.generate(as_json)
end