Class: FB2rb::Binary
- Inherits:
-
Object
- Object
- FB2rb::Binary
- Defined in:
- lib/fb2rb.rb
Overview
Holds data of a single binary within FB2 file
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id: nil, content: ''.b, content_type: nil) ⇒ Binary
constructor
A new instance of Binary.
- #to_xml(xml) ⇒ Object
Constructor Details
#initialize(id: nil, content: ''.b, content_type: nil) ⇒ Binary
Returns a new instance of Binary.
710 711 712 713 714 |
# File 'lib/fb2rb.rb', line 710 def initialize(id: nil, content: ''.b, content_type: nil) @id = id @content = content @content_type = content_type end |
Instance Attribute Details
#content ⇒ String
706 707 708 |
# File 'lib/fb2rb.rb', line 706 def content @content end |
#content_type ⇒ String?
708 709 710 |
# File 'lib/fb2rb.rb', line 708 def content_type @content_type end |
#id ⇒ String
704 705 706 |
# File 'lib/fb2rb.rb', line 704 def id @id end |
Class Method Details
Instance Method Details
#to_xml(xml) ⇒ Object
721 722 723 724 |
# File 'lib/fb2rb.rb', line 721 def to_xml(xml) encoded = [@content].pack('m0') xml.binary(encoded, 'id' => @id, 'content-type' => @content_type) end |