Class: Coltrane::UI::Router::History
- Inherits:
-
Object
- Object
- Coltrane::UI::Router::History
- Defined in:
- lib/coltrane/ui/router.rb
Instance Attribute Summary collapse
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
Instance Method Summary collapse
- #add(route) ⇒ Object
- #back ⇒ Object
- #current_route ⇒ Object
-
#initialize ⇒ History
constructor
A new instance of History.
- #previous ⇒ Object
- #refresh(params = {}) ⇒ Object
Constructor Details
#initialize ⇒ History
Returns a new instance of History.
22 23 24 |
# File 'lib/coltrane/ui/router.rb', line 22 def initialize @routes = [] end |
Instance Attribute Details
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
20 21 22 |
# File 'lib/coltrane/ui/router.rb', line 20 def routes @routes end |
Instance Method Details
#add(route) ⇒ Object
26 27 28 |
# File 'lib/coltrane/ui/router.rb', line 26 def add(route) @routes << route end |
#back ⇒ Object
38 39 40 |
# File 'lib/coltrane/ui/router.rb', line 38 def back routes.pop.render end |
#current_route ⇒ Object
34 35 36 |
# File 'lib/coltrane/ui/router.rb', line 34 def current_route routes[-1] end |
#previous ⇒ Object
30 31 32 |
# File 'lib/coltrane/ui/router.rb', line 30 def previous routes[-2]&.path || '' end |
#refresh(params = {}) ⇒ Object
42 43 44 |
# File 'lib/coltrane/ui/router.rb', line 42 def refresh(params={}) current_route.render(params) end |