A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://ruby-syntax-tree.github.io/syntax_tree/SyntaxTree/MethodAddBlock.html below:

class SyntaxTree::MethodAddBlock - RDoc Documentation

  1. SyntaxTree::
  2. MethodAddBlock
class SyntaxTree::MethodAddBlock

MethodAddBlock represents a method call with a block argument.

method {}
Attributes
BlockNode

the block being sent with the method call

Public Class Methods

Source

# File lib/syntax_tree/node.rb, line 7588
def initialize(call:, block:, location:)
  @call = call
  @block = block
  @location = location
  @comments = []
end
Public Instance Methods

Source

# File lib/syntax_tree/node.rb, line 7637
def ===(other)
  other.is_a?(MethodAddBlock) && call === other.call &&
    block === other.block
end

Source

# File lib/syntax_tree/node.rb, line 7595
def accept(visitor)
  visitor.visit_method_add_block(self)
end

Source

# File lib/syntax_tree/node.rb, line 7599
def child_nodes
  [call, block]
end

Source

# File lib/syntax_tree/node.rb, line 7603
def copy(call: nil, block: nil, location: nil)
  node =
    MethodAddBlock.new(
      call: call || self.call,
      block: block || self.block,
      location: location || self.location
    )

  node.comments.concat(comments.map(&:copy))
  node
end

Source

# File lib/syntax_tree/node.rb, line 7617
def deconstruct_keys(_keys)
  { call: call, block: block, location: location, comments: comments }
end

Source

# File lib/syntax_tree/node.rb, line 7621
def format(q)
  # If we're at the top of a call chain, then we're going to do some
  # specialized printing in case we can print it nicely. We _only_ do this
  # at the top of the chain to avoid weird recursion issues.
  if CallChainFormatter.chained?(call) &&
       !CallChainFormatter.chained?(q.parent)
    q.group do
      q
        .if_break { CallChainFormatter.new(self).format(q) }
        .if_flat { format_contents(q) }
    end
  else
    format_contents(q)
  end
end

Source

# File lib/syntax_tree/node.rb, line 7642
def format_contents(q)
  q.format(call)
  q.format(block)
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4