Class: SyntaxTree::Params::OptionalFormatter

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

Overview

Formats the optional position of the parameters. This includes the label, as well as the default value.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ OptionalFormatter

Returns a new instance of OptionalFormatter.



6729
6730
6731
6732
# File 'lib/syntax_tree/node.rb', line 6729

def initialize(name, value)
  @name = name
  @value = value
end

Instance Attribute Details

#name ⇒ Object (readonly)

[Ident] the name of the parameter



6724
6725
6726
# File 'lib/syntax_tree/node.rb', line 6724

def name
  @name
end

#value ⇒ Object (readonly)

[untyped] the value of the parameter



6727
6728
6729
# File 'lib/syntax_tree/node.rb', line 6727

def value
  @value
end

Instance Method Details

#comments ⇒ Object



6734
6735
6736
# File 'lib/syntax_tree/node.rb', line 6734

def comments
  []
end

#format(q) ⇒ Object



6738
6739
6740
6741
6742
# File 'lib/syntax_tree/node.rb', line 6738

def format(q)
  q.format(name)
  q.text(" = ")
  q.format(value)
end