Class: HyperRouter::History
- Inherits:
-
Object
- Object
- HyperRouter::History
- Includes:
- Native
- Defined in:
- lib/hyper-router/history.rb
Instance Method Summary collapse
- #block(message = nil) ⇒ Object
-
#initialize(native) ⇒ History
constructor
A new instance of History.
- #listen ⇒ Object
- #location ⇒ Object
- #to_n ⇒ Object
Constructor Details
#initialize(native) ⇒ History
Returns a new instance of History.
5 6 7 |
# File 'lib/hyper-router/history.rb', line 5 def initialize(native) @native = native end |
Instance Method Details
#block(message = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/hyper-router/history.rb', line 17 def block( = nil) if native_block(.to_n) else native_block do |location, action| yield Location.new(location), action end end end |
#listen ⇒ Object
27 28 29 30 31 |
# File 'lib/hyper-router/history.rb', line 27 def listen native_listen do |location, action| yield Location.new(location), action end end |
#location ⇒ Object
13 14 15 |
# File 'lib/hyper-router/history.rb', line 13 def location HyperRouter::Location.new(`#{@native}.location`) end |
#to_n ⇒ Object
9 10 11 |
# File 'lib/hyper-router/history.rb', line 9 def to_n @native end |