Class: SyntaxTree::Params::KeywordFormatter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ KeywordFormatter

Returns a new instance of KeywordFormatter.



8910
8911
8912
8913
# File 'lib/syntax_tree.rb', line 8910

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

Instance Attribute Details

#nameObject (readonly)

Ident

the name of the parameter



8905
8906
8907
# File 'lib/syntax_tree.rb', line 8905

def name
  @name
end

#valueObject (readonly)

nil | untyped

the value of the parameter



8908
8909
8910
# File 'lib/syntax_tree.rb', line 8908

def value
  @value
end

Instance Method Details

#commentsObject



8915
8916
8917
# File 'lib/syntax_tree.rb', line 8915

def comments
  []
end

#format(q) ⇒ Object



8919
8920
8921
8922
8923
8924
8925
8926
# File 'lib/syntax_tree.rb', line 8919

def format(q)
  q.format(name)

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