Class: Thrifty::HTTP::Server::Builder
- Inherits:
-
Object
- Object
- Thrifty::HTTP::Server::Builder
- Defined in:
- lib/thrifty/http_server/builder.rb
Instance Method Summary collapse
- #build(&block) ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #with_ip(value) ⇒ Object
- #with_name(value) ⇒ Object
- #with_port(value) ⇒ Object
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
4 5 6 7 8 9 10 11 |
# File 'lib/thrifty/http_server/builder.rb', line 4 def initialize require 'rack' require 'puma' @port = nil @ip = nil @name = nil end |
Instance Method Details
#build(&block) ⇒ Object
28 29 30 31 32 |
# File 'lib/thrifty/http_server/builder.rb', line 28 def build(&block) server = PumaServer.new(ip: @ip, port: @port, &block) server.start server end |
#with_ip(value) ⇒ Object
18 19 20 21 |
# File 'lib/thrifty/http_server/builder.rb', line 18 def with_ip(value) @ip = value self end |
#with_name(value) ⇒ Object
23 24 25 26 |
# File 'lib/thrifty/http_server/builder.rb', line 23 def with_name(value) @name = value self end |
#with_port(value) ⇒ Object
13 14 15 16 |
# File 'lib/thrifty/http_server/builder.rb', line 13 def with_port(value) @port = value.to_i self end |