Class: Riml::CurlyBracePart

Inherits:
Struct
  • Object
show all
Includes:
Visitable
Defined in:
lib/riml/nodes.rb

Constant Summary

Constants included from Visitable

Visitable::EMPTY_CHILDREN

Instance Attribute Summary collapse

Attributes included from Visitable

#compiled_output, #force_newline, #parent_node, #parser_info, #scope

Instance Method Summary collapse

Methods included from Visitable

#accept, #location_info

Methods included from Walkable

#child_after, #child_previous_to, #each, #index_by_children, #index_by_member, #insert_after, #insert_before, #next, #previous, #remove, #replace_with

Instance Attribute Details

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



562
563
564
# File 'lib/riml/nodes.rb', line 562

def value
  @value
end

Instance Method Details

#childrenObject



578
579
580
581
582
583
584
585
586
# File 'lib/riml/nodes.rb', line 578

def children
  if !interpolated?
    []
  elsif nested?
    value
  else
    [value]
  end
end

#force_newline_if_child_call_node?Boolean

Returns:

  • (Boolean)


574
575
576
# File 'lib/riml/nodes.rb', line 574

def force_newline_if_child_call_node?
  false
end

#interpolated?Boolean

Returns:

  • (Boolean)


565
566
567
568
# File 'lib/riml/nodes.rb', line 565

def interpolated?
  GetVariableNode === value || GetSpecialVariableNode === value ||
    CallNode === value || nested?
end

#nested?Boolean

Returns:

  • (Boolean)


570
571
572
# File 'lib/riml/nodes.rb', line 570

def nested?
  value.is_a?(Array) && value.detect {|part| part.is_a?(CurlyBracePart)}
end