Class: Scrapbox::Page
- Inherits:
-
Object
- Object
- Scrapbox::Page
- Defined in:
- lib/scrapbox/page.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #code(src) ⇒ Object
-
#initialize(project, title) ⇒ Page
constructor
A new instance of Page.
- #text ⇒ Object
Constructor Details
#initialize(project, title) ⇒ Page
Returns a new instance of Page.
6 7 8 9 10 11 |
# File 'lib/scrapbox/page.rb', line 6 def initialize(project,title) @project = project @title = title @text = nil @code = nil end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
4 5 6 |
# File 'lib/scrapbox/page.rb', line 4 def project @project end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/scrapbox/page.rb', line 4 def title @title end |
Instance Method Details
#code(src) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/scrapbox/page.rb', line 20 def code(src) unless @code @code = Scrapbox.__getsbdata("#{project.host}/api/code/#{project.name}/#{URI.encode(title)}/#{src}") end @code end |
#text ⇒ Object
13 14 15 16 17 18 |
# File 'lib/scrapbox/page.rb', line 13 def text unless @text @text = Scrapbox.__getsbdata("#{project.host}/api/pages/#{project.name}/#{URI.encode(title).gsub(/\//,'%2f')}/text") end @text end |