Class: ActiveRecordCopy::TempBuffer
- Inherits:
-
Object
- Object
- ActiveRecordCopy::TempBuffer
- Defined in:
- lib/activerecord-copy/temp_buffer.rb
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize ⇒ TempBuffer
constructor
A new instance of TempBuffer.
- #pos ⇒ Object
- #read ⇒ Object
- #reopen ⇒ Object
- #rewind ⇒ Object
- #size ⇒ Object
- #string ⇒ Object
- #write(st) ⇒ Object
Constructor Details
#initialize ⇒ TempBuffer
Returns a new instance of TempBuffer.
3 4 5 |
# File 'lib/activerecord-copy/temp_buffer.rb', line 3 def initialize @st = ''.force_encoding(ASCII_8BIT_ENCODING) end |
Instance Method Details
#empty? ⇒ Boolean
34 35 36 |
# File 'lib/activerecord-copy/temp_buffer.rb', line 34 def empty? @st.empty? end |
#pos ⇒ Object
26 27 28 |
# File 'lib/activerecord-copy/temp_buffer.rb', line 26 def pos @st.bytesize end |
#read ⇒ Object
22 23 24 |
# File 'lib/activerecord-copy/temp_buffer.rb', line 22 def read @st end |
#reopen ⇒ Object
18 19 20 |
# File 'lib/activerecord-copy/temp_buffer.rb', line 18 def reopen @st = '' end |
#rewind ⇒ Object
15 16 |
# File 'lib/activerecord-copy/temp_buffer.rb', line 15 def rewind end |
#size ⇒ Object
7 8 9 |
# File 'lib/activerecord-copy/temp_buffer.rb', line 7 def size @st.bytesize end |
#string ⇒ Object
30 31 32 |
# File 'lib/activerecord-copy/temp_buffer.rb', line 30 def string @st end |
#write(st) ⇒ Object
11 12 13 |
# File 'lib/activerecord-copy/temp_buffer.rb', line 11 def write(st) @st << st.dup.force_encoding(ASCII_8BIT_ENCODING) end |