Class: React::Component::Props
- Inherits:
-
Object
- Object
- React::Component::Props
show all
- Includes:
- Native::Wrapper
- Defined in:
- lib/react/component/props.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(prop, *args, &block) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/react/component/props.rb', line 6
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
16
17
18
|
# File 'lib/react/component/props.rb', line 16
def classes
@classes ||= `Opal.React.Component.Styles.$new(#@native.props.classes)`
end
|
#history ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/react/component/props.rb', line 29
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
24
25
26
|
# File 'lib/react/component/props.rb', line 24
def isomorfeus_store
@native.JS[:props].JS[:isomorfeus_store]
end
|
#location ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/react/component/props.rb', line 38
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
47
48
49
50
51
52
53
54
|
# File 'lib/react/component/props.rb', line 47
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
20
21
22
|
# File 'lib/react/component/props.rb', line 20
def theme
@theme ||= `Opal.React.Component.Styles.$new(#@native.props.theme)`
end
|
#to_n ⇒ Object
56
57
58
|
# File 'lib/react/component/props.rb', line 56
def to_n
@native.JS[:props]
end
|