Class: Hyperloop::Router::Component

Inherits:
Object
  • Object
show all
Defined in:
lib/hyperloop/router/component.rb

Class Method Summary collapse

Class Method Details

.inherited(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/hyperloop/router/component.rb', line 4

def self.inherited(base)
  base.include(React::Component)
  base.include(HyperRouter::ComponentMethods)

  base.class_eval do
    param :match, default: nil
    param :location, default: nil
    param :history, default: nil

    define_method(:match) do
      params.match
    end

    define_method(:location) do
      params.location
    end

    define_method(:history) do
      params.history
    end
  end
end