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.



6694
6695
6696
6697
# File 'lib/syntax_tree/node.rb', line 6694

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

Instance Attribute Details

#nameObject (readonly)

Ident

the name of the parameter



6689
6690
6691
# File 'lib/syntax_tree/node.rb', line 6689

def name
  @name
end

#valueObject (readonly)

untyped

the value of the parameter



6692
6693
6694
# File 'lib/syntax_tree/node.rb', line 6692

def value
  @value
end

Instance Method Details

#commentsObject



6699
6700
6701
# File 'lib/syntax_tree/node.rb', line 6699

def comments
  []
end

#format(q) ⇒ Object



6703
6704
6705
6706
6707
# File 'lib/syntax_tree/node.rb', line 6703

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