Class: Trexrb
- Inherits:
-
Object
- Object
- Trexrb
- Defined in:
- lib/trexrb.rb,
lib/trexrb/version.rb
Constant Summary collapse
- DEFAULT_HOST =
'localhost'
- DEFAULT_PORT =
4040
- VERSION =
"0.1.2"
Instance Method Summary collapse
- #get(key) ⇒ Object (also: #[])
-
#initialize(host = nil, port = nil) ⇒ Trexrb
constructor
A new instance of Trexrb.
- #keys ⇒ Object
- #set(key, value) ⇒ Object (also: #[]=)
Constructor Details
#initialize(host = nil, port = nil) ⇒ Trexrb
Returns a new instance of Trexrb.
9 10 11 12 |
# File 'lib/trexrb.rb', line 9 def initialize(host = nil, port = nil) @host = host || DEFAULT_HOST @port = port || DEFAULT_PORT end |
Instance Method Details
#get(key) ⇒ Object Also known as: []
14 15 16 17 18 19 20 |
# File 'lib/trexrb.rb', line 14 def get(key) with_connection do |conn| conn.print Request.new.get(key) Response.new(conn.read).body end end |