Class: Micetrap::Server
- Inherits:
-
Object
- Object
- Micetrap::Server
- Defined in:
- lib/micetrap/server.rb
Instance Attribute Summary collapse
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #fire! ⇒ Object
-
#initialize(options) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(options) ⇒ Server
Returns a new instance of Server.
8 9 10 11 12 13 14 15 |
# File 'lib/micetrap/server.rb', line 8 def initialize() raise StandardError.new("Service cannot be empty!") unless [:service] @service = eval("Micetrap::Services::#{[:service].to_s.capitalize}").new @port = [:port] # Optional rescue NameError=>e raise Services::UnrecognizedServiceException.new("Service #{[:service].to_s.capitalize} is not recognized") end |
Instance Attribute Details
#port ⇒ Object (readonly)
Returns the value of attribute port.
6 7 8 |
# File 'lib/micetrap/server.rb', line 6 def port @port end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
5 6 7 |
# File 'lib/micetrap/server.rb', line 5 def service @service end |
Instance Method Details
#fire! ⇒ Object
17 18 19 |
# File 'lib/micetrap/server.rb', line 17 def fire! @service.fire port end |