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.



6779
6780
6781
6782
# File 'lib/syntax_tree/node.rb', line 6779

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

Instance Attribute Details

#nameObject (readonly)

Ident

the name of the parameter



6774
6775
6776
# File 'lib/syntax_tree/node.rb', line 6774

def name
  @name
end

#valueObject (readonly)

untyped

the value of the parameter



6777
6778
6779
# File 'lib/syntax_tree/node.rb', line 6777

def value
  @value
end

Instance Method Details

#commentsObject



6784
6785
6786
# File 'lib/syntax_tree/node.rb', line 6784

def comments
  []
end

#format(q) ⇒ Object



6788
6789
6790
6791
6792
# File 'lib/syntax_tree/node.rb', line 6788

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