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



6618
6619
6620
6621
# File 'lib/syntax_tree/node.rb', line 6618

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

Instance Attribute Details

#nameObject (readonly)

Ident

the name of the parameter



6613
6614
6615
# File 'lib/syntax_tree/node.rb', line 6613

def name
  @name
end

#valueObject (readonly)

untyped

the value of the parameter



6616
6617
6618
# File 'lib/syntax_tree/node.rb', line 6616

def value
  @value
end

Instance Method Details

#commentsObject



6623
6624
6625
# File 'lib/syntax_tree/node.rb', line 6623

def comments
  []
end

#format(q) ⇒ Object



6627
6628
6629
6630
6631
# File 'lib/syntax_tree/node.rb', line 6627

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