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.



8165
8166
8167
8168
# File 'lib/syntax_tree/node.rb', line 8165

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

Instance Attribute Details

#nameObject (readonly)

Ident

the name of the parameter



8160
8161
8162
# File 'lib/syntax_tree/node.rb', line 8160

def name
  @name
end

#valueObject (readonly)

Node

the value of the parameter



8163
8164
8165
# File 'lib/syntax_tree/node.rb', line 8163

def value
  @value
end

Instance Method Details

#commentsObject



8170
8171
8172
# File 'lib/syntax_tree/node.rb', line 8170

def comments
  []
end

#format(q) ⇒ Object



8174
8175
8176
8177
8178
# File 'lib/syntax_tree/node.rb', line 8174

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