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.



8196
8197
8198
8199
# File 'lib/syntax_tree/node.rb', line 8196

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

Instance Attribute Details

#nameObject (readonly)

Ident

the name of the parameter



8191
8192
8193
# File 'lib/syntax_tree/node.rb', line 8191

def name
  @name
end

#valueObject (readonly)

Node

the value of the parameter



8194
8195
8196
# File 'lib/syntax_tree/node.rb', line 8194

def value
  @value
end

Instance Method Details

#commentsObject



8201
8202
8203
# File 'lib/syntax_tree/node.rb', line 8201

def comments
  []
end

#format(q) ⇒ Object



8205
8206
8207
8208
8209
# File 'lib/syntax_tree/node.rb', line 8205

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