HashLiteral
represents a hash literal.
{ key => value }Attributes
LBrace
the left brace that opens this hash
def initialize(lbrace:, assocs:, location:) @lbrace = lbrace @assocs = assocs @location = location @comments = [] endPublic Instance Methods Source
def ===(other) other.is_a?(HashLiteral) && lbrace === other.lbrace && ArrayMatch.call(assocs, other.assocs) endSource
def accept(visitor) visitor.visit_hash(self) endSource
def child_nodes [lbrace].concat(assocs) endSource
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 endSource
def deconstruct_keys(_keys) { lbrace: lbrace, assocs: assocs, location: location, comments: comments } endSource
def format(q) if q.parent.is_a?(Assoc) format_contents(q) else q.group { format_contents(q) } end endSource
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