1. Prism::
  2. EnsureNode

class Prism::EnsureNode

Represents anensure clause in abegin statement.

begin  fooensure^^^^^^  barend

Attributes

statements[R]

attr_reader statements:StatementsNode?

Public Class Methods

Source
# File lib/prism/node.rb, line 7073definitialize(source,node_id,location,flags,ensure_keyword_loc,statements,end_keyword_loc)@source =source@node_id =node_id@location =location@flags =flags@ensure_keyword_loc =ensure_keyword_loc@statements =statements@end_keyword_loc =end_keyword_locend

Initialize a newEnsureNode node.

Source
# File lib/prism/node.rb, line 7175defself.type:ensure_nodeend

Return a symbol representation of this node type. SeeNode::type.

Public Instance Methods

Source
# File lib/prism/node.rb, line 7181def===(other)other.is_a?(EnsureNode)&&    (ensure_keyword_loc.nil?==other.ensure_keyword_loc.nil?)&&    (statements===other.statements)&&    (end_keyword_loc.nil?==other.end_keyword_loc.nil?)end

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.

Source
# File lib/prism/node.rb, line 7084defaccept(visitor)visitor.visit_ensure_node(self)end

def accept: (Visitor visitor) -> void

Source
# File lib/prism/node.rb, line 7089defchild_nodes  [statements]end

defchild_nodes: () ->Array

Also aliased as:deconstruct
Source
# File lib/prism/node.rb, line 7108defcomment_targets  [ensure_keyword_loc,*statements,end_keyword_loc]#: Array[Prism::node | Location]end

defcomment_targets: () -> Array[Node | Location]

Source
# File lib/prism/node.rb, line 7101defcompact_child_nodescompact = []#: Array[Prism::node]compact<<statementsifstatementscompactend

defcompact_child_nodes: () ->Array

Source
# File lib/prism/node.rb, line 7113defcopy(node_id:self.node_id,location:self.location,flags:self.flags,ensure_keyword_loc:self.ensure_keyword_loc,statements:self.statements,end_keyword_loc:self.end_keyword_loc)EnsureNode.new(source,node_id,location,flags,ensure_keyword_loc,statements,end_keyword_loc)end

def copy: (?node_id:Integer, ?location:Location, ?flags:Integer, ?ensure_keyword_loc:Location, ?statements:StatementsNode?, ?end_keyword_loc:Location) ->EnsureNode

def deconstruct: () ->Array

Alias for:child_nodes
Source
# File lib/prism/node.rb, line 7121defdeconstruct_keys(keys)  {node_id:node_id,location:location,ensure_keyword_loc:ensure_keyword_loc,statements:statements,end_keyword_loc:end_keyword_loc }end

defdeconstruct_keys: (Array keys) -> { node_id:Integer, location:Location,ensure_keyword_loc:Location, statements:StatementsNode?,end_keyword_loc:Location }

Source
# File lib/prism/node.rb, line 7094defeach_child_nodereturnto_enum(:each_child_node)unlessblock_given?yieldstatementsifstatementsend

defeach_child_node: () { (Prism::node) -> void } -> void | () ->Enumerator

Source
# File lib/prism/node.rb, line 7160defend_keywordend_keyword_loc.sliceend

defend_keyword: () ->String

Source
# File lib/prism/node.rb, line 7142defend_keyword_loclocation =@end_keyword_locreturnlocationiflocation.is_a?(Location)@end_keyword_loc =Location.new(source,location>>32,location&0xFFFFFFFF)end

attr_readerend_keyword_loc:Location

Source
# File lib/prism/node.rb, line 7155defensure_keywordensure_keyword_loc.sliceend

defensure_keyword: () ->String

Source
# File lib/prism/node.rb, line 7126defensure_keyword_loclocation =@ensure_keyword_locreturnlocationiflocation.is_a?(Location)@ensure_keyword_loc =Location.new(source,location>>32,location&0xFFFFFFFF)end

attr_readerensure_keyword_loc:Location

Source
# File lib/prism/node.rb, line 7165definspectInspectVisitor.compose(self)end

def inspect ->String

Source
# File lib/prism/node.rb, line 7150defsave_end_keyword_loc(repository)repository.enter(node_id,:end_keyword_loc)end

Save theend_keyword_loc location using the given saved source so that it can be retrieved later.

Source
# File lib/prism/node.rb, line 7134defsave_ensure_keyword_loc(repository)repository.enter(node_id,:ensure_keyword_loc)end

Save theensure_keyword_loc location using the given saved source so that it can be retrieved later.

Source
# File lib/prism/node.rb, line 7170deftype:ensure_nodeend

Return a symbol representation of this node type. SeeNode#type.