Class: Amber::Server
- Inherits:
-
Object
- Object
- Amber::Server
- Defined in:
- lib/amber/server.rb
Instance Attribute Summary collapse
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
Constructor Details
#initialize(options) ⇒ Server
Returns a new instance of Server.
16 17 18 19 20 21 22 |
# File 'lib/amber/server.rb', line 16 def initialize() @site = [:site] @host = [:host] @port = [:port] @server = WEBrick::HTTPServer.new :Port => @port, :BindAddress => @host, :DocumentRoot => @site.dest_dir @server.mount '/', StaticPageServlet, self end |
Instance Attribute Details
#port ⇒ Object (readonly)
Returns the value of attribute port.
10 11 12 |
# File 'lib/amber/server.rb', line 10 def port @port end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
9 10 11 |
# File 'lib/amber/server.rb', line 9 def site @site end |
Class Method Details
Instance Method Details
#start ⇒ Object
24 25 26 27 28 29 |
# File 'lib/amber/server.rb', line 24 def start trap 'INT' do @server.shutdown end @server.start end |