Class: SyntaxTree::HshPtn::KeywordRestFormatter

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

Overview

Formats the optional double-splat from the pattern.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keyword_rest) ⇒ KeywordRestFormatter

Returns a new instance of KeywordRestFormatter.



6024
6025
6026
# File 'lib/syntax_tree/node.rb', line 6024

def initialize(keyword_rest)
  @keyword_rest = keyword_rest
end

Instance Attribute Details

#keyword_restObject (readonly)

VarField

the parameter that matches the remaining keywords



6022
6023
6024
# File 'lib/syntax_tree/node.rb', line 6022

def keyword_rest
  @keyword_rest
end

Instance Method Details

#commentsObject



6028
6029
6030
# File 'lib/syntax_tree/node.rb', line 6028

def comments
  []
end

#format(q) ⇒ Object



6032
6033
6034
6035
# File 'lib/syntax_tree/node.rb', line 6032

def format(q)
  q.text("**")
  q.format(keyword_rest)
end