Class: Miron::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/miron/server.rb

Overview

Miron::Server allows HTTP responses to be sent.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mironfile, options) ⇒ Response

Returns the newly created Miron::Server

Parameters:


16
17
18
19
20
# File 'lib/miron/server.rb', line 16

def initialize(mironfile, options)
  @mironfile = mironfile
  @options = options
  resolve_handler
end

Instance Attribute Details

#handlerObject

Returns the value of attribute handler


6
7
8
# File 'lib/miron/server.rb', line 6

def handler
  @handler
end

#mironfileObject (readonly)

Returns the value of attribute mironfile


5
6
7
# File 'lib/miron/server.rb', line 5

def mironfile
  @mironfile
end

#optionsObject (readonly)

Returns the value of attribute options


5
6
7
# File 'lib/miron/server.rb', line 5

def options
  @options
end

Instance Method Details

#startObject


22
23
24
25
26
27
# File 'lib/miron/server.rb', line 22

def start
  # Set options defaults and run the handler
  @options['environment'] = ENV['MIRON_ENV'] || 'development'
  @options['host'] = '0.0.0.0'
  @handler.run(@mironfile, @options)
end