Class: Jets::Controller::Stage
- Inherits:
-
Object
- Object
- Jets::Controller::Stage
- Defined in:
- lib/jets/controller/stage.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add ⇒ Object
- #add_stage? ⇒ Boolean
-
#initialize(host, url) ⇒ Stage
constructor
A new instance of Stage.
- #on_cloud9? ⇒ Boolean
Constructor Details
#initialize(host, url) ⇒ Stage
Returns a new instance of Stage.
3 4 5 |
# File 'lib/jets/controller/stage.rb', line 3 def initialize(host, url) @host, @url = host, url end |
Class Method Details
.add(host, url) ⇒ Object
24 25 26 |
# File 'lib/jets/controller/stage.rb', line 24 def add(host, url) new(host, url).add end |
.on_cloud9?(host) ⇒ Boolean
28 29 30 |
# File 'lib/jets/controller/stage.rb', line 28 def on_cloud9?(host) !!(host =~ /cloud9\..*\.amazonaws\.com/) end |
Instance Method Details
#add ⇒ Object
7 8 9 10 11 12 |
# File 'lib/jets/controller/stage.rb', line 7 def add return @url unless add_stage? stage_name = Jets::Resource::ApiGateway::Deployment.stage_name "/#{stage_name}#{@url}" end |
#add_stage? ⇒ Boolean
14 15 16 17 |
# File 'lib/jets/controller/stage.rb', line 14 def add_stage? return false if on_cloud9? @host.include?("amazonaws.com") && @url.starts_with?('/') end |
#on_cloud9? ⇒ Boolean
19 20 21 |
# File 'lib/jets/controller/stage.rb', line 19 def on_cloud9? self.class.on_cloud9?(@host) end |