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

class SyntaxTree::SClass - RDoc Documentation

  1. SyntaxTree::
  2. SClass
class SyntaxTree::SClass

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
end
Attributes
Node

the target of the singleton class to enter

Public Class Methods

Source

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

Source

def ===(other)
  other.is_a?(SClass) && target === other.target &&
    bodystmt === other.bodystmt
end

Source

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

Source

def child_nodes
  [target, bodystmt]
end

Source

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
end

Source

def deconstruct_keys(_keys)
  {
    target: target,
    bodystmt: bodystmt,
    location: location,
    comments: comments
  }
end

Source

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