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.



6779
6780
6781
# File 'lib/syntax_tree/node.rb', line 6779

def initialize(value)
  @value = value
end

Instance Attribute Details

#value ⇒ Object (readonly)

[:nil | ArgsForward | KwRestParam] the value of the parameter



6777
6778
6779
# File 'lib/syntax_tree/node.rb', line 6777

def value
  @value
end

Instance Method Details

#comments ⇒ Object



6783
6784
6785
# File 'lib/syntax_tree/node.rb', line 6783

def comments
  []
end

#format(q) ⇒ Object



6787
6788
6789
# File 'lib/syntax_tree/node.rb', line 6787

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