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.



6796
6797
6798
6799
# File 'lib/syntax_tree/node.rb', line 6796

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

Instance Attribute Details

#nameObject (readonly)

Ident

the name of the parameter



6791
6792
6793
# File 'lib/syntax_tree/node.rb', line 6791

def name
  @name
end

#valueObject (readonly)

untyped

the value of the parameter



6794
6795
6796
# File 'lib/syntax_tree/node.rb', line 6794

def value
  @value
end

Instance Method Details

#commentsObject



6801
6802
6803
# File 'lib/syntax_tree/node.rb', line 6801

def comments
  []
end

#format(q) ⇒ Object



6805
6806
6807
6808
6809
# File 'lib/syntax_tree/node.rb', line 6805

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