Class: FB2rb::Stylesheet
- Inherits:
-
Object
- Object
- FB2rb::Stylesheet
- Defined in:
- lib/fb2rb.rb
Overview
Holds <stylesheet> data
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(content_type: '', content: nil) ⇒ Stylesheet
constructor
A new instance of Stylesheet.
- #to_xml(xml) ⇒ Object
Constructor Details
#initialize(content_type: '', content: nil) ⇒ Stylesheet
Returns a new instance of Stylesheet.
249 250 251 252 |
# File 'lib/fb2rb.rb', line 249 def initialize(content_type: '', content: nil) @content_type = content_type @content = content end |
Instance Attribute Details
#content ⇒ String?
247 248 249 |
# File 'lib/fb2rb.rb', line 247 def content @content end |
#content_type ⇒ String
245 246 247 |
# File 'lib/fb2rb.rb', line 245 def content_type @content_type end |
Class Method Details
.parse(xml) ⇒ Object
254 255 256 |
# File 'lib/fb2rb.rb', line 254 def self.parse(xml) Stylesheet.new(content_type: xml['type'], content: xml.text) end |
Instance Method Details
#to_xml(xml) ⇒ Object
258 259 260 261 262 |
# File 'lib/fb2rb.rb', line 258 def to_xml(xml) return if @content.nil? xml.send('stylesheet', @content, 'type' => @content_type) end |