Sha256: 682a324fb2558c113bd117f52afc9888dd8af2405812c3b35634096de9411ea3

Contents?: true

Size: 961 Bytes

Versions: 13

Compression:

Stored size: 961 Bytes

Contents

module HyperRouter
  class History
    include Native

    def initialize(native)
      @native = native
    end

    def to_n
      @native
    end

    def location
      HyperRouter::Location.new(`#{@native}.location`)
    end

    def block(message = nil)
      if message
        native_block(message.to_n)
      else
        native_block do |location, action|
          yield Location.new(location), action
        end
      end
    end

    def listen
      native_listen do |location, action|
        yield Location.new(location), action
      end
    end

    alias_native :action
    alias_native :native_block, :block
    alias_native :create_href, :createHref
    alias_native :entries
    alias_native :go
    alias_native :go_back, :goBack
    alias_native :go_forward, :goForward
    alias_native :index
    alias_native :length
    alias_native :native_listen, :listen
    alias_native :push, :push
    alias_native :replace, :replace
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
hyper-router-0.99.6 lib/hyper-router/history.rb
hyper-router-0.99.5 lib/hyper-router/history.rb
hyper-router-0.99.4 lib/hyper-router/history.rb
hyper-router-0.99.3 lib/hyper-router/history.rb
hyper-router-0.99.2 lib/hyper-router/history.rb
hyper-router-0.99.1 lib/hyper-router/history.rb
hyper-router-4.2.6.lap28 lib/hyper-router/history.rb
hyper-router-4.2.6.lap27 lib/hyper-router/history.rb
hyper-router-4.2.6.lap26 lib/hyper-router/history.rb
hyper-router-4.2.6.lap25 lib/hyper-router/history.rb
hyper-router-4.2.6.lap24 lib/hyper-router/history.rb
hyper-router-4.2.6.lap23 lib/hyper-router/history.rb
hyper-router-4.2.6.lap22 lib/hyper-router/history.rb