Class: RequestRequest

Inherits:
Object show all
Defined in:
lib/rwd/net.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(firstline) ⇒ RequestRequest

Returns a new instance of RequestRequest.



544
545
546
547
548
549
550
551
552
553
554
# File 'lib/rwd/net.rb', line 544

def initialize(firstline)
  @method, @uri, @protocol	= firstline.split(/ /)
  @path, @data		= @uri.split(/\?/)
  @data			= ""			if @data.nil?	# TODO

#    i	= @path.index(/%[[:digit:]]{2}/)
#    while not i.nil?
#      @path	= @path[0..(i-1)] + @path[(i+1)..(i+2)].unpack('H2').shift.to_i.chr + @path[(i+3)..-1]
#      i	= @path.index(/%[[:digit:]]{2}/)
#    end
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



541
542
543
# File 'lib/rwd/net.rb', line 541

def data
  @data
end

#methodObject (readonly)

Returns the value of attribute method.



538
539
540
# File 'lib/rwd/net.rb', line 538

def method
  @method
end

#pathObject (readonly)

Returns the value of attribute path.



540
541
542
# File 'lib/rwd/net.rb', line 540

def path
  @path
end

#protocolObject (readonly)

Returns the value of attribute protocol.



542
543
544
# File 'lib/rwd/net.rb', line 542

def protocol
  @protocol
end

#uriObject (readonly)

Returns the value of attribute uri.



539
540
541
# File 'lib/rwd/net.rb', line 539

def uri
  @uri
end

Instance Method Details

#inspectObject



560
561
562
# File 'lib/rwd/net.rb', line 560

def inspect
  "(RequestRequest: %s)" % [@method, @path, @data, @protocol].join(", ")
end

#to_sObject



556
557
558
# File 'lib/rwd/net.rb', line 556

def to_s
  "#{@method} #{@uri} #{@protocol}\r\n"
end