Class: Rediscover::App
- Inherits:
-
Wx::App
- Object
- Wx::App
- Rediscover::App
- Defined in:
- lib/rediscover/app.rb
Constant Summary collapse
- DEFAULTS =
{ :host => 'localhost', :port => 6379 }
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
Instance Method Summary collapse
- #connect(host, port) ⇒ Object
- #display_connect ⇒ Object
- #display_main ⇒ Object
- #on_init ⇒ Object
- #on_run ⇒ Object
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
31 32 33 |
# File 'lib/rediscover/app.rb', line 31 def host @host end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
31 32 33 |
# File 'lib/rediscover/app.rb', line 31 def logger @logger end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
31 32 33 |
# File 'lib/rediscover/app.rb', line 31 def port @port end |
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
31 32 33 |
# File 'lib/rediscover/app.rb', line 31 def redis @redis end |
Instance Method Details
#connect(host, port) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/rediscover/app.rb', line 56 def connect(host, port) begin @redis = Redis.new(:host => host, :port => port) @redis.connect_to_server # connection errors will be rescued by Frame::Connect @host, @port = host, port @connect_frame.close rescue => e logger.error(e) @conn_refused_dlg = Dialog::Error.new(@connect_frame, "Can't connect to server.", 'Unable to Connect') @conn_refused_dlg.show_modal return end display_main end |
#display_connect ⇒ Object
48 49 50 |
# File 'lib/rediscover/app.rb', line 48 def display_connect @connect_frame = Frame::Connect.new end |
#display_main ⇒ Object
52 53 54 |
# File 'lib/rediscover/app.rb', line 52 def display_main @main_frame = Frame::Main.new end |
#on_init ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/rediscover/app.rb', line 33 def on_init @logger = Logger.new('rediscover.log') ExceptionHandler.set_logger(@logger) @host = DEFAULTS[:host] @port = DEFAULTS[:port] display_connect end |
#on_run ⇒ Object
42 43 44 45 46 |
# File 'lib/rediscover/app.rb', line 42 def on_run super rescue Exception => e @logger.fatal(e) end |