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.



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

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

Instance Attribute Details

#nameObject (readonly)

Ident

the name of the parameter



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

def name
  @name
end

#valueObject (readonly)

untyped

the value of the parameter



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

def value
  @value
end

Instance Method Details

#commentsObject



6745
6746
6747
# File 'lib/syntax_tree/node.rb', line 6745

def comments
  []
end

#format(q) ⇒ Object



6749
6750
6751
6752
6753
# File 'lib/syntax_tree/node.rb', line 6749

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