mirror of https://github.com/freeCodeCamp/devdocs
parent
e9125c6ec2
commit
5c46eabc67
@ -0,0 +1,25 @@
|
||||
require 'yajl/json_gem'
|
||||
|
||||
module Docs
|
||||
class PageDb
|
||||
attr_reader :pages
|
||||
|
||||
delegate :empty?, :blank?, to: :pages
|
||||
|
||||
def initialize
|
||||
@pages = {}
|
||||
end
|
||||
|
||||
def add(path, content)
|
||||
@pages[path] = content
|
||||
end
|
||||
|
||||
def as_json
|
||||
@pages
|
||||
end
|
||||
|
||||
def to_json
|
||||
JSON.generate(as_json)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in new issue