Module: CfScript::Scope::App::Routes

Included in:
CfScript::Scope::App
Defined in:
lib/cf_script/scope/app/routes.rb

Instance Method Summary collapse

Instance Method Details

#has_route?(domain, host = nil) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
# File 'lib/cf_script/scope/app/routes.rb', line 3

def has_route?(domain, host = nil)
  route = [host, domain].compact.join('.')

  urls.include?(route)
end

#map_route(domain, host = nil) ⇒ Object



9
10
11
12
13
# File 'lib/cf_script/scope/app/routes.rb', line 9

def map_route(domain, host =  nil)
  CfScript::Command.map_route name, domain, host do |mapped|
    cf_self; has_route?(domain, host)
  end
end

#unmap_route(domain, host = nil) ⇒ Object



15
16
17
18
19
# File 'lib/cf_script/scope/app/routes.rb', line 15

def unmap_route(domain, host =  nil)
  CfScript::Command.unmap_route name, domain, host do |unmapped|
    cf_self; not has_route?(domain, host)
  end
end