Sha256: 94199fb60135421173ff8ccc5c970db5d045f13ffc7d45bc92be717c6f257da6
Contents?: true
Size: 642 Bytes
Versions: 19
Compression:
Stored size: 642 Bytes
Contents
module React class Children include Enumerable def initialize(children) @children = children end 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 def length @length ||= `React.Children.count(#{@children})` end alias_method :size, :length end end
Version data entries
19 entries across 19 versions & 2 rubygems