SClass
represents a block of statements that should be evaluated within the context of the singleton class of an object. It’s frequently used to define singleton methods.
class << self endAttributes
Node
the target of the singleton class to enter
def initialize(target:, bodystmt:, location:) @target = target @bodystmt = bodystmt @location = location @comments = [] endPublic Instance Methods Source
def ===(other) other.is_a?(SClass) && target === other.target && bodystmt === other.bodystmt endSource
def accept(visitor) visitor.visit_sclass(self) endSource
def child_nodes [target, bodystmt] endSource
def copy(target: nil, bodystmt: nil, location: nil) node = SClass.new( target: target || self.target, bodystmt: bodystmt || self.bodystmt, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node endSource
def deconstruct_keys(_keys) { target: target, bodystmt: bodystmt, location: location, comments: comments } endSource
def format(q) q.text("class << ") q.group do q.format(target) q.indent do q.breakable_force q.format(bodystmt) end q.breakable_force end q.text("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