Class: ReadMailState
Instance Attribute Summary collapse
-
#protocol ⇒ Object
Returns the value of attribute protocol.
Instance Method Summary collapse
-
#initialize(protocol = nil) ⇒ ReadMailState
constructor
A new instance of ReadMailState.
- #not_end_of_message(line) ⇒ Object
- #read_message(io) ⇒ Object
- #serve(io) ⇒ Object
Methods included from Messages
#go_ahead, #goodbye, #greeting, #helo_response, #ok
Constructor Details
#initialize(protocol = nil) ⇒ ReadMailState
Returns a new instance of ReadMailState.
78 79 80 |
# File 'lib/smtp_states.rb', line 78 def initialize(protocol = nil) @protocol = protocol end |
Instance Attribute Details
#protocol ⇒ Object
Returns the value of attribute protocol.
75 76 77 |
# File 'lib/smtp_states.rb', line 75 def protocol @protocol end |
Instance Method Details
#not_end_of_message(line) ⇒ Object
102 103 104 |
# File 'lib/smtp_states.rb', line 102 def (line) not line.strip.eql?('.') end |
#read_message(io) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/smtp_states.rb', line 90 def (io) = '' line = io.readline while (line) << line line = io.readline end end |
#serve(io) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/smtp_states.rb', line 82 def serve(io) = (io) @protocol.() ok(io) :quit end |