Module: React::Children
- Defined in:
- lib/react/children.rb
Class Method Summary collapse
- .count(children) ⇒ Object
- .for_each(children, &block) ⇒ Object
- .map(children, &block) ⇒ Object
- .only(children) ⇒ Object
- .to_array(children) ⇒ Object
Class Method Details
.count(children) ⇒ Object
4 5 6 |
# File 'lib/react/children.rb', line 4 def count(children) `Opal.global.React.Children.count(children)` end |
.for_each(children, &block) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/react/children.rb', line 8 def for_each(children, &block) %x{ var fun = function(child) { #{block.call(child)}; } Opal.global.React.Children.forEach(children, fun); } end |
.map(children, &block) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/react/children.rb', line 17 def map(children, &block) %x{ var fun = function(child) { return #{block.call(child)}; } return Opal.global.React.Children.map(children, fun); } end |
.only(children) ⇒ Object
26 27 28 |
# File 'lib/react/children.rb', line 26 def only(children) `Opal.global.React.Children.only(children)` end |
.to_array(children) ⇒ Object
30 31 32 |
# File 'lib/react/children.rb', line 30 def to_array(children) `Opal.global.React.Children.toArray(children)` end |