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.



6668
6669
6670
# File 'lib/syntax_tree/node.rb', line 6668

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

:nil | ArgsForward | KwRestParam

the value of the parameter



6666
6667
6668
# File 'lib/syntax_tree/node.rb', line 6666

def value
  @value
end

Instance Method Details

#commentsObject



6672
6673
6674
# File 'lib/syntax_tree/node.rb', line 6672

def comments
  []
end

#format(q) ⇒ Object



6676
6677
6678
# File 'lib/syntax_tree/node.rb', line 6676

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