Class: ErbLatex::StringIO
- Inherits:
-
StringIO
- Object
- StringIO
- ErbLatex::StringIO
- Defined in:
- lib/erb_latex/stringio.rb
Overview
An ErbLatex::StringIO extends Ruby’s StringIO with a path and file name This allows it to be used in situations where a File is expected
Instance Attribute Summary collapse
-
#filepath ⇒ String
Complete virtual path for the data.
Instance Method Summary collapse
-
#initialize(name = '') ⇒ StringIO
constructor
A new instance of StringIO.
-
#original_filename ⇒ Object
define original_filename for clients that depend on it, i.e.
-
#rename(name) ⇒ Object
reset filepath.
Constructor Details
#initialize(name = '') ⇒ StringIO
Returns a new instance of StringIO.
13 14 15 16 17 |
# File 'lib/erb_latex/stringio.rb', line 13 def initialize( name='' ) @filepath = name super('') self.set_encoding( Encoding.find("UTF-8") ) end |
Instance Attribute Details
#filepath ⇒ String
Returns complete virtual path for the data.
11 12 13 |
# File 'lib/erb_latex/stringio.rb', line 11 def filepath @filepath end |
Instance Method Details
#original_filename ⇒ Object
define original_filename for clients that depend on it, i.e. carrierwave
21 22 23 |
# File 'lib/erb_latex/stringio.rb', line 21 def original_filename File.basename(filepath) end |
#rename(name) ⇒ Object
reset filepath
28 29 30 31 |
# File 'lib/erb_latex/stringio.rb', line 28 def rename( name ) @filepath = name self end |