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.



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

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

Instance Attribute Details

#nameObject (readonly)

Ident

the name of the parameter



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

def name
  @name
end

#valueObject (readonly)

Node

the value of the parameter



8204
8205
8206
# File 'lib/syntax_tree/node.rb', line 8204

def value
  @value
end

Instance Method Details

#commentsObject



8211
8212
8213
# File 'lib/syntax_tree/node.rb', line 8211

def comments
  []
end

#format(q) ⇒ Object



8215
8216
8217
8218
8219
# File 'lib/syntax_tree/node.rb', line 8215

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