Class: Pancake::Router::MountedApplication
- Defined in:
- lib/pancake/router.rb
Overview
Instance Attribute Summary collapse
- #args ⇒ Object
- #mount_path ⇒ Object
- #mounted ⇒ Object
- #mounted_app ⇒ Object
- #options ⇒ Object
- #stackup_with ⇒ Object
Instance Method Summary collapse
-
#initialize(mounted_app, mount_path, opts = {}) ⇒ MountedApplication
constructor
A new instance of MountedApplication.
- #mount!(route) ⇒ Object
- #mounted? ⇒ Boolean
- #name(name = nil) ⇒ Object
Constructor Details
#initialize(mounted_app, mount_path, opts = {}) ⇒ MountedApplication
Returns a new instance of MountedApplication.
50 51 52 53 54 55 |
# File 'lib/pancake/router.rb', line 50 def initialize(mounted_app, mount_path, opts = {}) @mounted_app, @mount_path = mounted_app, mount_path @stackup_with = opts.delete(:_stackup) || :stackup @args = opts.delete(:_args) || [] @options = opts end |
Instance Attribute Details
#mount_path ⇒ Object
49 50 51 |
# File 'lib/pancake/router.rb', line 49 def mount_path @mount_path end |
#mounted_app ⇒ Object
49 50 51 |
# File 'lib/pancake/router.rb', line 49 def mounted_app @mounted_app end |
#stackup_with ⇒ Object
49 50 51 |
# File 'lib/pancake/router.rb', line 49 def stackup_with @stackup_with end |
Instance Method Details
#mount!(route) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/pancake/router.rb', line 68 def mount!(route) app = nil if mounted_app.respond_to?(stackup_with) app = mounted_app.send(stackup_with, *args) else app = mounted_app end route.to(app) route.name(@name) if @name route.partial route end |
#mounted? ⇒ Boolean
64 65 66 |
# File 'lib/pancake/router.rb', line 64 def mounted? !!@mounted end |
#name(name = nil) ⇒ Object
57 58 59 60 61 62 |
# File 'lib/pancake/router.rb', line 57 def name(name = nil) unless name.nil? @name = name end @name end |