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.



6974
6975
6976
6977
# File 'lib/syntax_tree/node.rb', line 6974

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

Instance Attribute Details

#nameObject (readonly)

Ident

the name of the parameter



6969
6970
6971
# File 'lib/syntax_tree/node.rb', line 6969

def name
  @name
end

#valueObject (readonly)

untyped

the value of the parameter



6972
6973
6974
# File 'lib/syntax_tree/node.rb', line 6972

def value
  @value
end

Instance Method Details

#commentsObject



6979
6980
6981
# File 'lib/syntax_tree/node.rb', line 6979

def comments
  []
end

#format(q) ⇒ Object



6983
6984
6985
6986
6987
# File 'lib/syntax_tree/node.rb', line 6983

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