Class: React::Component::Props
- Inherits:
-
Object
- Object
- React::Component::Props
show all
- Defined in:
- lib/react/component/props.rb
Instance Method Summary
collapse
Constructor Details
#initialize(native) ⇒ Props
Returns a new instance of Props.
4
5
6
|
# File 'lib/react/component/props.rb', line 4
def initialize(native)
@native = native
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(prop, *args, &block) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/react/component/props.rb', line 8
def method_missing(prop, *args, &block)
%x{
if (typeof #@native.props[prop] === 'undefined') {
prop = Opal.React.lower_camelize(prop);
if (typeof #@native.props[prop] === 'undefined') { return #{nil}; }
}
return #@native.props[prop];
}
end
|
Instance Method Details
#classes ⇒ Object
18
19
20
|
# File 'lib/react/component/props.rb', line 18
def classes
@classes ||= `Opal.React.Component.Styles.$new(#@native, 'classes')`
end
|
#history ⇒ Object
31
32
33
34
35
36
37
38
|
# File 'lib/react/component/props.rb', line 31
def history
return nil if `typeof #@native.props.history === 'undefined'`
if `typeof #@native.props.history.pathname !== 'undefined'`
React::Component::History.new(@native.JS[:props].JS[:history])
else
@native.JS[:props].JS[:history]
end
end
|
#isomorfeus_store ⇒ Object
26
27
28
|
# File 'lib/react/component/props.rb', line 26
def isomorfeus_store
@native.JS[:props].JS[:isomorfeus_store]
end
|
#location ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'lib/react/component/props.rb', line 40
def location
return nil if `typeof #@native.props.location === 'undefined'`
if `typeof #@native.props.location.pathname !== 'undefined'`
React::Component::Location.new(@native.JS[:props].JS[:location])
else
@native.JS[:props].JS[:location]
end
end
|
#match ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'lib/react/component/props.rb', line 49
def match
return nil if `typeof #@native.props.match === 'undefined'`
if `typeof #@native.props.match.path !== 'undefined'`
React::Component::Match.new(@native.JS[:props].JS[:match])
else
@native.JS[:props].JS[:match]
end
end
|
#theme ⇒ Object
22
23
24
|
# File 'lib/react/component/props.rb', line 22
def theme
@theme ||= `Opal.React.Component.Styles.$new(#@native, 'theme')`
end
|
#to_n ⇒ Object
58
59
60
|
# File 'lib/react/component/props.rb', line 58
def to_n
@native.JS[:props]
end
|