Assoc
represents a key-value pair within a hash. It is a child node of either an AssocListFromArgs or a BareAssocHash
.
{ key1: value1, key2: value2 }
In
the above example, the would be two Assoc
nodes.
Node
the key of this pair
Node
the value of this pair
def initialize(key:, value:, location:) @key = key @value = value @location = location @comments = [] endPublic Instance Methods Source
def ===(other) other.is_a?(Assoc) && key === other.key && value === other.value endSource
def accept(visitor) visitor.visit_assoc(self) endSource
def child_nodes [key, value] endSource
def copy(key: nil, value: nil, location: nil) node = Assoc.new( key: key || self.key, value: value || self.value, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node endSource
def deconstruct_keys(_keys) { key: key, value: value, location: location, comments: comments } endSource
def format(q) if value.is_a?(HashLiteral) format_contents(q) else q.group { format_contents(q) } 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