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.



8098
8099
8100
8101
# File 'lib/syntax_tree/node.rb', line 8098

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

Instance Attribute Details

#nameObject (readonly)

Ident

the name of the parameter



8093
8094
8095
# File 'lib/syntax_tree/node.rb', line 8093

def name
  @name
end

#valueObject (readonly)

untyped

the value of the parameter



8096
8097
8098
# File 'lib/syntax_tree/node.rb', line 8096

def value
  @value
end

Instance Method Details

#commentsObject



8103
8104
8105
# File 'lib/syntax_tree/node.rb', line 8103

def comments
  []
end

#format(q) ⇒ Object



8107
8108
8109
8110
8111
# File 'lib/syntax_tree/node.rb', line 8107

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