Module: Waxx::Console

Extended by:
Console
Included in:
Console
Defined in:
waxx/console.rb

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

Instance Method Summary collapse

Instance Attribute Details

#dbObject

Returns the value of attribute db



11
12
13
# File 'waxx/console.rb', line 11

def db
  @db
end

#xObject

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

#initObject

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