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

class SyntaxTree::HashLiteral - RDoc Documentation

  1. SyntaxTree::
  2. HashLiteral
class SyntaxTree::HashLiteral

HashLiteral represents a hash literal.

{ key => value }
Attributes
LBrace

the left brace that opens this hash

Public Class Methods

Source

def initialize(lbrace:, assocs:, location:)
  @lbrace = lbrace
  @assocs = assocs
  @location = location
  @comments = []
end
Public Instance Methods

Source

def ===(other)
  other.is_a?(HashLiteral) && lbrace === other.lbrace &&
    ArrayMatch.call(assocs, other.assocs)
end

Source

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

Source

def child_nodes
  [lbrace].concat(assocs)
end

Source

def copy(lbrace: nil, assocs: nil, location: nil)
  node =
    HashLiteral.new(
      lbrace: lbrace || self.lbrace,
      assocs: assocs || self.assocs,
      location: location || self.location
    )

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

Source

def deconstruct_keys(_keys)
  { lbrace: lbrace, assocs: assocs, location: location, comments: comments }
end

Source

def format(q)
  if q.parent.is_a?(Assoc)
    format_contents(q)
  else
    q.group { format_contents(q) }
  end
end

Source

def format_key(q, key)
  (@key_formatter ||= HashKeyFormatter.for(self)).format_key(q, key)
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