Class: Presser::PresserDoc
- Inherits:
-
Object
- Object
- Presser::PresserDoc
- Defined in:
- lib/presser_doc.rb
Instance Attribute Summary collapse
-
#categories ⇒ Object
Returns the value of attribute categories.
-
#post_status ⇒ Object
Returns the value of attribute post_status.
-
#postid ⇒ Object
Returns the value of attribute postid.
Instance Method Summary collapse
-
#initialize(*args) ⇒ PresserDoc
constructor
A new instance of PresserDoc.
- #new_doc ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ PresserDoc
Returns a new instance of PresserDoc.
7 8 9 10 11 |
# File 'lib/presser_doc.rb', line 7 def initialize *args @title = args[0] || "This is the title" @link = args[1] || "http://www.google.com" @description = args[2] || "This is the description" end |
Instance Attribute Details
#categories ⇒ Object
Returns the value of attribute categories.
6 7 8 |
# File 'lib/presser_doc.rb', line 6 def categories @categories end |
#post_status ⇒ Object
Returns the value of attribute post_status.
6 7 8 |
# File 'lib/presser_doc.rb', line 6 def post_status @post_status end |
#postid ⇒ Object
Returns the value of attribute postid.
6 7 8 |
# File 'lib/presser_doc.rb', line 6 def postid @postid end |
Instance Method Details
#new_doc ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/presser_doc.rb', line 23 def new_doc doc = REXML::Document.new item = doc.add_element "struct" title = item.add_element 'title' link = item.add_element "link" description = item.add_element "description" description.text = @description title.text = @title link.text = @link # str = "" # doc.write(str, 2) # puts str str = "" doc.write str str end |
#to_s ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/presser_doc.rb', line 13 def to_s str = %Q{# Beginning of header title: #{@title} link: #{@link} postid: #{postid} post_status: #{post_status} # End of header #{@description}} end |