Sha256: 709bafc6b913404c52481cb4a0ea48b06766f6e987342963d084c56e09718bca

Contents?: true

Size: 487 Bytes

Versions: 1

Compression:

Stored size: 487 Bytes

Contents

module React
  module DSL
    $$.React.DOM.each do |name, factory| 
      define_method(name) do |props = nil, children = nil, &block|
        if children.nil?
          if `Array.isArray(props)`
            children = props
            props = nil
          elsif !props.nil? && `typeof props !== 'object'`
            children = [props]
            props = nil
          end
        end
        `return factory(#{React.fix_props(props)}, #{children.to_n});`
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-react-0.0.5 lib/opal/react/dsl.rb