class React::Children

Public Class Methods

new(children) click to toggle source
# File lib/react/children.rb, line 5
def initialize(children)
  @children = children
end

Public Instance Methods

each(&block) click to toggle source
# File lib/react/children.rb, line 9
def each(&block)
  return to_enum(__callee__) { length } unless block_given?
  return [] unless length > 0
  collection = []
  %x{
    React.Children.forEach(#{@children}, function(context){
      #{
        element = React::Element.new(`context`)
        block.call(element)
        collection << element
      }
    })
  }
  collection
end
length() click to toggle source
# File lib/react/children.rb, line 25
def length
  @length ||= `React.Children.count(#{@children})`
end
Also aliased as: size
size()
Alias for: length