Class: SyntaxTree::Params::KeywordFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ KeywordFormatter

Returns a new instance of KeywordFormatter.



6540
6541
6542
6543
# File 'lib/syntax_tree/node.rb', line 6540

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

Instance Attribute Details

#name ⇒ Object (readonly)

[Ident] the name of the parameter



6535
6536
6537
# File 'lib/syntax_tree/node.rb', line 6535

def name
  @name
end

#value ⇒ Object (readonly)

[nil | untyped] the value of the parameter



6538
6539
6540
# File 'lib/syntax_tree/node.rb', line 6538

def value
  @value
end

Instance Method Details

#comments ⇒ Object



6545
6546
6547
# File 'lib/syntax_tree/node.rb', line 6545

def comments
  []
end

#format(q) ⇒ Object



6549
6550
6551
6552
6553
6554
6555
6556
# File 'lib/syntax_tree/node.rb', line 6549

def format(q)
  q.format(name)

  if value
    q.text(" ")
    q.format(value)
  end
end