Class: TFTP::Protocol::WRQ
- Inherits:
-
BinData::Record
- Object
- BinData::Record
- TFTP::Protocol::WRQ
- Defined in:
- lib/tftp/protocol.rb
Overview
WRQ Packet
Instance Method Summary collapse
Instance Method Details
#create(opts = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/tftp/protocol.rb', line 32 def create(opts = {}) self.opcode = OP_WRQ if opts[:filename] == nil raise TFTP::Error.(:no_filename_provided) else self.filename = opts[:filename] end self.mode = opts.fetch(:mode, "octet") raise TFTP::Error.(:unsupported_mode) if !VALID_MODES.any?{ |s| s.casecmp(self.mode)==0 } self end |