Class: Amber

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

Defined Under Namespace

Modules: DataDelegate Classes: Controller, Data, Http, Model, Route, RoutePath, Server, Storage, Switch, View

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAmber

Returns a new instance of Amber.



4
5
6
7
8
9
10
11
# File 'lib/amber.rb', line 4

def initialize
  @route = Amber::Route.new
  @option = {}

  if block_given?
    yield self
  end
end

Instance Attribute Details

#optionObject (readonly)

Returns the value of attribute option.



2
3
4
# File 'lib/amber.rb', line 2

def option
  @option
end

#routeObject (readonly)

Returns the value of attribute route.



2
3
4
# File 'lib/amber.rb', line 2

def route
  @route
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
# File 'lib/amber.rb', line 13

def run
  server_port = @option.has_key?("port") ? @option["port"] : 3001
  @server = Amber::Server.new server_port
  @server.base = self
  @server.prepare
  @server.start
end