Class: MockServerThin
- Inherits:
-
Object
- Object
- MockServerThin
- Defined in:
- lib/mock_server_thin.rb
Defined Under Namespace
Modules: Methods Classes: App, Config
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(app, opts = {}, &block) ⇒ MockServerThin
constructor
A new instance of MockServerThin.
- #start ⇒ Object
Constructor Details
#initialize(app, opts = {}, &block) ⇒ MockServerThin
Returns a new instance of MockServerThin.
40 41 42 43 44 45 46 47 |
# File 'lib/mock_server_thin.rb', line 40 def initialize(app, opts = {}, &block) @app = app = config.to_hash.merge!(opts) puts "SERVER OPTIONS: %s" % .inspect @port = [:port] @timeout = [:timeout] @host = [:host] end |
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
11 12 13 |
# File 'lib/mock_server_thin.rb', line 11 def config @config end |
Class Method Details
.configure {|config| ... } ⇒ Object
28 29 30 |
# File 'lib/mock_server_thin.rb', line 28 def self.configure yield(config) end |
Instance Method Details
#config ⇒ Object
36 37 38 |
# File 'lib/mock_server_thin.rb', line 36 def config self.class.config end |
#start ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/mock_server_thin.rb', line 49 def start Thread.new do with_quiet_logger do |logger| Rack::Handler::Thin.run(@app, :Port => @port, :Logger => logger, :AccessLog => []) end end wait_for_service(@host, @port) self end |