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/RAssign.html below:

class SyntaxTree::RAssign - RDoc Documentation

  1. SyntaxTree::
  2. RAssign
class SyntaxTree::RAssign

RAssign represents a single-line pattern match.

value in pattern
value => pattern
Attributes
Kw | Op

the operator being used to match against the pattern, which is

either => or in

Node

the pattern on the right-hand side of the expression

Node

the left-hand expression

Public Class Methods

Source

def initialize(value:, operator:, pattern:, location:)
  @value = value
  @operator = operator
  @pattern = pattern
  @location = location
  @comments = []
end
Public Instance Methods

Source

def ===(other)
  other.is_a?(RAssign) && value === other.value &&
    operator === other.operator && pattern === other.pattern
end

Source

def accept(visitor)
  visitor.visit_rassign(self)
end

Source

def child_nodes
  [value, operator, pattern]
end

Source

def copy(value: nil, operator: nil, pattern: nil, location: nil)
  node =
    RAssign.new(
      value: value || self.value,
      operator: operator || self.operator,
      pattern: pattern || self.pattern,
      location: location || self.location
    )

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

Source

def deconstruct_keys(_keys)
  {
    value: value,
    operator: operator,
    pattern: pattern,
    location: location,
    comments: comments
  }
end

Source

def format(q)
  q.group do
    q.format(value)
    q.text(" ")
    q.format(operator)

    case pattern
    when AryPtn, FndPtn, HshPtn
      q.text(" ")
      q.format(pattern)
    else
      q.group do
        q.indent do
          q.breakable_space
          q.format(pattern)
        end
      end
    end
  end
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