Class: SyntaxTree::Params::KeywordRestFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

Overview

Formats the keyword_rest position of the parameters. This can be the **nil syntax, the … syntax, or the ** syntax.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ KeywordRestFormatter

Returns a new instance of KeywordRestFormatter.



7024
7025
7026
# File 'lib/syntax_tree/node.rb', line 7024

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

:nil | ArgsForward | KwRestParam

the value of the parameter



7022
7023
7024
# File 'lib/syntax_tree/node.rb', line 7022

def value
  @value
end

Instance Method Details

#commentsObject



7028
7029
7030
# File 'lib/syntax_tree/node.rb', line 7028

def comments
  []
end

#format(q) ⇒ Object



7032
7033
7034
# File 'lib/syntax_tree/node.rb', line 7032

def format(q)
  value == :nil ? q.text("**nil") : q.format(value)
end