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.
280 281 282 283 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 280 def initialize( str = '' ) @buffer = str super() end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
299 300 301 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 299 def ==( other ) StringPort === other and @buffer.equal? other.string end |
#aopen(&block) ⇒ Object
327 328 329 330 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 327 def aopen( &block ) @buffer ||= '' StringOutput.new(@buffer, &block) end |
#copy_to(port) ⇒ Object Also known as: cp
338 339 340 341 342 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 338 def copy_to( port ) port.wopen {|f| f.write @buffer } end |
#hash ⇒ Object
305 306 307 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 305 def hash @buffer.id.hash end |
#inspect ⇒ Object
309 310 311 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 309 def inspect "#<#{self.class}:id=#{sprintf '0x%x', @buffer.id}>" end |
#move_to(port) ⇒ Object
346 347 348 349 350 351 352 353 354 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 346 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
332 333 334 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 332 def remove @buffer = nil end |
#reproducible? ⇒ Boolean
313 314 315 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 313 def reproducible? true end |
#ropen(&block) ⇒ Object
317 318 319 320 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 317 def ropen( &block ) @buffer or raise Errno::ENOENT, "#{inspect} is already removed" StringInput.open(@buffer, &block) end |
#size ⇒ Object
295 296 297 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 295 def size @buffer.size end |
#string ⇒ Object
285 286 287 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 285 def string @buffer end |
#to_s ⇒ Object Also known as: read_all
289 290 291 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 289 def to_s @buffer.dup end |
#wopen(&block) ⇒ Object
322 323 324 325 |
# File 'lib/action_mailer/vendor/tmail/port.rb', line 322 def wopen( &block ) @buffer = '' StringOutput.new(@buffer, &block) end |