Class: HTML2FB::Text
- Inherits:
-
Object
- Object
- HTML2FB::Text
- Defined in:
- lib/Html2Feedbooks/document.rb,
lib/Html2Feedbooks/feedbooks.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
-
#initialize(c = '') ⇒ Text
constructor
A new instance of Text.
- #titles ⇒ Object
- #to_feedbooks(conf, path = nil) ⇒ Object
- #to_html ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(c = '') ⇒ Text
Returns a new instance of Text.
55 56 57 |
# File 'lib/Html2Feedbooks/document.rb', line 55 def initialize(c='') @content=c end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
53 54 55 |
# File 'lib/Html2Feedbooks/document.rb', line 53 def content @content end |
Instance Method Details
#titles ⇒ Object
67 68 69 |
# File 'lib/Html2Feedbooks/document.rb', line 67 def titles return ['#text'] end |
#to_feedbooks(conf, path = nil) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/Html2Feedbooks/feedbooks.rb', line 105 def to_feedbooks(conf,path=nil) stxt=to_html return unless stxt.strip.size > 0 doc=Nokogiri::XML('<div xmlns:xhtml="http://www.w3.org/1999/xhtml">'+stxt+'</div>') doc.traverse do |e| if e.element? e.name='xhtml:'+e.name end end FBPost.push(conf,'',doc.to_html,"Text",path) end |
#to_html ⇒ Object
59 60 61 |
# File 'lib/Html2Feedbooks/document.rb', line 59 def to_html @content end |
#to_s ⇒ Object
63 64 65 |
# File 'lib/Html2Feedbooks/document.rb', line 63 def to_s @content end |