Class: DocPDF::InputNormalizer
- Inherits:
-
Object
- Object
- DocPDF::InputNormalizer
- Defined in:
- lib/docpdf/input_normalizer.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#mime_type ⇒ Object
readonly
Returns the value of attribute mime_type.
-
#source_filename ⇒ Object
readonly
Returns the value of attribute source_filename.
Instance Method Summary collapse
-
#initialize(source = nil, io: nil, data: nil, filename: nil, mime_type: nil) ⇒ InputNormalizer
constructor
A new instance of InputNormalizer.
Constructor Details
#initialize(source = nil, io: nil, data: nil, filename: nil, mime_type: nil) ⇒ InputNormalizer
Returns a new instance of InputNormalizer.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/docpdf/input_normalizer.rb', line 5 def initialize(source = nil, io: nil, data: nil, filename: nil, mime_type: nil) @data, source_filename, detected_mime = extract(source, io, data) # MIME detection uses the source's original filename, not the user's # display-name override, unless the source has no filename at all # (e.g., raw data: with a filename: hint). @source_filename = source_filename @filename = filename || source_filename @mime_type = mime_type || detected_mime || MimeDetector.detect(source_filename || filename) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/docpdf/input_normalizer.rb', line 3 def data @data end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
3 4 5 |
# File 'lib/docpdf/input_normalizer.rb', line 3 def filename @filename end |
#mime_type ⇒ Object (readonly)
Returns the value of attribute mime_type.
3 4 5 |
# File 'lib/docpdf/input_normalizer.rb', line 3 def mime_type @mime_type end |
#source_filename ⇒ Object (readonly)
Returns the value of attribute source_filename.
3 4 5 |
# File 'lib/docpdf/input_normalizer.rb', line 3 def source_filename @source_filename end |