Class: JsxRosetta::IR::Conditional

Inherits:
Data
  • Object
show all
Includes:
Node
Defined in:
lib/jsx_rosetta/ir/types.rb

Overview

A conditional render. Lowered from any of:

{cond && <X />}
{cond ? <X /> : null}
{cond ? <X /> : <Y />}

test : Interpolation — verbatim JS source of the condition. consequent : Node — what to render when test is truthy. alternate : Node | nil — what to render otherwise (nil for ‘cond &&`

or for `cond ? X : null`).

Instance Attribute Summary collapse

Instance Attribute Details

#alternateObject (readonly)

Returns the value of attribute alternate

Returns:

  • (Object)

    the current value of alternate



195
196
197
# File 'lib/jsx_rosetta/ir/types.rb', line 195

def alternate
  @alternate
end

#consequentObject (readonly)

Returns the value of attribute consequent

Returns:

  • (Object)

    the current value of consequent



195
196
197
# File 'lib/jsx_rosetta/ir/types.rb', line 195

def consequent
  @consequent
end

#testObject (readonly)

Returns the value of attribute test

Returns:

  • (Object)

    the current value of test



195
196
197
# File 'lib/jsx_rosetta/ir/types.rb', line 195

def test
  @test
end