Class: OWNet::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/connection.rb

Overview

Encapsulates a request to owserver

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Request

Returns a new instance of Request.



35
36
37
38
# File 'lib/connection.rb', line 35

def initialize(opts={})
  opts.each {|name, value| self.send(name.to_s+'=', value)}
  @flags = 258 #FIXME: What is this?
end

Instance Attribute Details

#flagsObject

Returns the value of attribute flags.



33
34
35
# File 'lib/connection.rb', line 33

def flags
  @flags
end

#functionObject

Returns the value of attribute function.



33
34
35
# File 'lib/connection.rb', line 33

def function
  @function
end

#pathObject

Returns the value of attribute path.



33
34
35
# File 'lib/connection.rb', line 33

def path
  @path
end

#valueObject

Returns the value of attribute value.



33
34
35
# File 'lib/connection.rb', line 33

def value
  @value
end

Instance Method Details

#write(socket) ⇒ Object



56
57
58
59
60
61
62
63
64
# File 'lib/connection.rb', line 56

def write(socket)
  socket.write(header)
  case self.function
  when READ, DIR
    socket.write(path + "\000")
  when WRITE
    socket.write(path + "\000" + value + "\000")
  end
end