Class: Excursion::Pool::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/excursion/pool/dsl.rb

Class Method Summary collapse

Class Method Details

.block_eval(app = nil, &block) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/excursion/pool/dsl.rb', line 5

def self.block_eval(app=nil, &block)
  @application = app.is_a?(Excursion::Pool::Application) ? app : Excursion::Pool::Application.new('', {})
  instance_eval &block if block_given?

  raise "You must assign a name to the application" if @application.name.blank?
  @application
end

.default_url_options(url_options) ⇒ Object



17
18
19
# File 'lib/excursion/pool/dsl.rb', line 17

def self.default_url_options(url_options)
  @application.default_url_options = url_options
end

.name(name_str) ⇒ Object



13
14
15
# File 'lib/excursion/pool/dsl.rb', line 13

def self.name(name_str)
  @application.name = name_str
end

.route(name, path) ⇒ Object



25
26
27
# File 'lib/excursion/pool/dsl.rb', line 25

def self.route(name, path)
  @application.add_route(name.to_sym, path)
end

.routes(route_hash) ⇒ Object



21
22
23
# File 'lib/excursion/pool/dsl.rb', line 21

def self.routes(route_hash)
  @application.routes = route_hash
end