Class: Mangos::Book

Inherits:
Object
  • Object
show all
Defined in:
lib/mangos/book.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyObject

Returns the value of attribute key.



2
3
4
# File 'lib/mangos/book.rb', line 2

def key
  @key
end

#old_keyObject

Returns the value of attribute old_key.



2
3
4
# File 'lib/mangos/book.rb', line 2

def old_key
  @old_key
end

#page_pathsObject

Returns the value of attribute page_paths.



2
3
4
# File 'lib/mangos/book.rb', line 2

def page_paths
  @page_paths
end

#pagesObject

Returns the value of attribute pages.



2
3
4
# File 'lib/mangos/book.rb', line 2

def pages
  @pages
end

#pathObject

Returns the value of attribute path.



2
3
4
# File 'lib/mangos/book.rb', line 2

def path
  @path
end

#published_onObject

Returns the value of attribute published_on.



2
3
4
# File 'lib/mangos/book.rb', line 2

def published_on
  @published_on
end

#tagsObject

Returns the value of attribute tags.



2
3
4
# File 'lib/mangos/book.rb', line 2

def tags
  @tags
end

Class Method Details

.from_hash(hash) ⇒ Object



13
14
15
16
17
# File 'lib/mangos/book.rb', line 13

def self.from_hash(hash)
  book = new
  book.from_hash(hash)
  book
end

Instance Method Details

#from_hash(hash) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/mangos/book.rb', line 4

def from_hash(hash)
  @path = hash["path"]
  @page_paths = hash["pagePaths"]
  @pages = hash["pages"]
  @published_on = hash["publishedOn"]
  @key = hash["key"]
  @tags = hash["tags"]
end

#to_hashObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/mangos/book.rb', line 19

def to_hash
  {
    "path" => @path,
    "pagePaths" => @page_paths,
    "pages" => @pages,
    "publishedOn" => @published_on,
    "key" => @key,
    "tags" => @tags
  }
end