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
- #exact_match? ⇒ Boolean
-
#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.
53 54 55 56 57 58 59 |
# File 'lib/pancake/router.rb', line 53 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) || [] @exact_match = opts.delete(:_exact_match) || false @options = opts end |
Instance Attribute Details
#mount_path ⇒ Object
52 53 54 |
# File 'lib/pancake/router.rb', line 52 def mount_path @mount_path end |
#mounted_app ⇒ Object
52 53 54 |
# File 'lib/pancake/router.rb', line 52 def mounted_app @mounted_app end |
#stackup_with ⇒ Object
52 53 54 |
# File 'lib/pancake/router.rb', line 52 def stackup_with @stackup_with end |
Instance Method Details
#exact_match? ⇒ Boolean
72 73 74 |
# File 'lib/pancake/router.rb', line 72 def exact_match? !!@exact_match end |
#mount!(route) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/pancake/router.rb', line 76 def mount!(route) app = nil route.consuming = true route.match_partially! unless exact_match? 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 end |
#mounted? ⇒ Boolean
68 69 70 |
# File 'lib/pancake/router.rb', line 68 def mounted? !!@mounted end |
#name(name = nil) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/pancake/router.rb', line 61 def name(name = nil) unless name.nil? @name = name end @name end |