Class: Page
- Inherits:
-
Object
- Object
- Page
- Defined in:
- lib/asciidoctor/page.rb
Constant Summary collapse
- TYPE =
'page'
- REPRESENTATION =
'storage'
Instance Attribute Summary collapse
-
#page_id ⇒ Object
readonly
Returns the value of attribute page_id.
-
#revision ⇒ Object
writeonly
Sets the attribute revision.
-
#space_key ⇒ Object
readonly
Returns the value of attribute space_key.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(space_key, title, document, page_id) ⇒ Page
constructor
A new instance of Page.
- #to_json ⇒ Object
Constructor Details
#initialize(space_key, title, document, page_id) ⇒ Page
Returns a new instance of Page.
10 11 12 13 14 15 16 |
# File 'lib/asciidoctor/page.rb', line 10 def initialize(space_key, title, document, page_id) @space_key = space_key @title = title @document = document @page_id = page_id @revision = nil end |
Instance Attribute Details
#page_id ⇒ Object (readonly)
Returns the value of attribute page_id.
7 8 9 |
# File 'lib/asciidoctor/page.rb', line 7 def page_id @page_id end |
#revision=(value) ⇒ Object (writeonly)
Sets the attribute revision
8 9 10 |
# File 'lib/asciidoctor/page.rb', line 8 def revision=(value) @revision = value end |
#space_key ⇒ Object (readonly)
Returns the value of attribute space_key.
7 8 9 |
# File 'lib/asciidoctor/page.rb', line 7 def space_key @space_key end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
7 8 9 |
# File 'lib/asciidoctor/page.rb', line 7 def title @title end |
Instance Method Details
#to_json ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/asciidoctor/page.rb', line 18 def to_json page = { :type => TYPE, :title => @title, :space => { :key => @space_key }, :body => { :storage => { :value => @document, :representation => REPRESENTATION } } } page[:version] = {:number => @revision} unless @revision.nil? page[:id] = @page_id unless @page_id.nil? JSON.generate page end |