Class: TMail::StringPort
- Defined in:
- lib/action_mailer/vendor/tmail/port.rb
Overview
StringPort
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #aopen(&block) ⇒ Object
- #copy_to(port) ⇒ Object (also: #cp)
- #hash ⇒ Object
-
#initialize(str = '') ⇒ StringPort
constructor
A new instance of StringPort.
- #inspect ⇒ Object
- #move_to(port) ⇒ Object
- #remove ⇒ Object (also: #rm)
- #reproducible? ⇒ Boolean
- #ropen(&block) ⇒ Object
- #size ⇒ Object
- #string ⇒ Object
- #to_s ⇒ Object (also: #read_all)
- #wopen(&block) ⇒ Object
Constructor Details
#initialize(str = '') ⇒ StringPort
Returns a new instance of StringPort.
299 300 301 302 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 299 def initialize( str = '' ) @buffer = str super() end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
318 319 320 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 318 def ==( other ) StringPort === other and @buffer.equal? other.string end |
#aopen(&block) ⇒ Object
346 347 348 349 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 346 def aopen( &block ) @buffer ||= '' StringOutput.new(@buffer, &block) end |
#copy_to(port) ⇒ Object Also known as: cp
357 358 359 360 361 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 357 def copy_to( port ) port.wopen {|f| f.write @buffer } end |
#hash ⇒ Object
324 325 326 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 324 def hash @buffer.object_id.hash end |
#inspect ⇒ Object
328 329 330 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 328 def inspect "#<#{self.class}:id=#{sprintf '0x%x', @buffer.object_id}>" end |
#move_to(port) ⇒ Object
365 366 367 368 369 370 371 372 373 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 365 def move_to( port ) if StringPort === port str = @buffer port.instance_eval { @buffer = str } else copy_to port end remove end |
#remove ⇒ Object Also known as: rm
351 352 353 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 351 def remove @buffer = nil end |
#reproducible? ⇒ Boolean
332 333 334 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 332 def reproducible? true end |
#ropen(&block) ⇒ Object
336 337 338 339 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 336 def ropen( &block ) @buffer or raise Errno::ENOENT, "#{inspect} is already removed" StringInput.open(@buffer, &block) end |
#size ⇒ Object
314 315 316 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 314 def size @buffer.size end |
#string ⇒ Object
304 305 306 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 304 def string @buffer end |
#to_s ⇒ Object Also known as: read_all
308 309 310 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 308 def to_s @buffer.dup end |
#wopen(&block) ⇒ Object
341 342 343 344 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 341 def wopen( &block ) @buffer = '' StringOutput.new(@buffer, &block) end |