class SyntaxTree::CallOperatorFormatter

Wraps a call operator (which can be a string literal

or an Op node or a

Period node) and formats it when called.

Attributes

operator[R]
:“::” | Op | Period

the operator being formatted

Public Class Methods

new(operator) click to toggle source
# File lib/syntax_tree/node.rb, line 2687
def initialize(operator)
  @operator = operator
end

Public Instance Methods

comments() click to toggle source
# File lib/syntax_tree/node.rb, line 2691
def comments
  operator == :"::" ? [] : operator.comments
end
format(q) click to toggle source
# File lib/syntax_tree/node.rb, line 2695
def format(q)
  case operator
  when :"::"
    q.text(".")
  when Op
    operator.value == "::" ? q.text(".") : operator.format(q)
  else
    operator.format(q)
  end
end