Module: Waxx::Console
Overview
The console module that is available with irb When `waxx console` is called, the dbs are connected and a StringIO class acts as the response container
Defined Under Namespace
Modules: Command Classes: Stringy
Instance Attribute Summary collapse
-
#db ⇒ Object
Returns the value of attribute db.
-
#x ⇒ Object
The x variable used on the console.
Instance Method Summary collapse
-
#get(path, opts = {}) ⇒ Object
Run a GET request.
-
#init ⇒ Object
Initialize the console variables.
Instance Attribute Details
#db ⇒ Object
Returns the value of attribute db
11 12 13 |
# File 'waxx/console.rb', line 11 def db @db end |
#x ⇒ Object
The x variable used on the console. Singleton.
58 59 60 |
# File 'waxx/console.rb', line 58 def x @x end |
Instance Method Details
#get(path, opts = {}) ⇒ Object
Run a GET request
45 46 47 48 49 50 51 52 53 54 55 |
# File 'waxx/console.rb', line 45 def get(path, opts={}) puts path @db ||= Waxx::Database.connections io = Stringy.new "GET #{path} HTTP1/0\n#{ENV.map{|n,v| "#{n}: #{v}"}.join("\n")}" x = Waxx::Server.process_request(io, @db) #if ARGV[0] == "get" puts x.res.out #else # x.res.out.join #end end |
#init ⇒ Object
Initialize the console variables
38 39 40 41 42 |
# File 'waxx/console.rb', line 38 def init @db = Waxx::Database.connections io = Stringy.new "GET /app/ok HTTP1/0\n#{ENV.map{|n,v| "#{n}: #{v}"}.join("\n")}" @x = Waxx::Server.process_request(io, @db) end |