Class: SyntaxTree::Alias::AliasArgumentFormatter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argument) ⇒ AliasArgumentFormatter

Returns a new instance of AliasArgumentFormatter.



729
730
731
# File 'lib/syntax_tree.rb', line 729

def initialize(argument)
  @argument = argument
end

Instance Attribute Details

#argumentObject (readonly)

DynaSymbol | SymbolLiteral

the argument being passed to alias



727
728
729
# File 'lib/syntax_tree.rb', line 727

def argument
  @argument
end

Instance Method Details

#commentsObject



733
734
735
736
737
738
739
# File 'lib/syntax_tree.rb', line 733

def comments
  if argument.is_a?(SymbolLiteral)
    argument.comments + argument.value.comments
  else
    argument.comments
  end
end

#format(q) ⇒ Object



741
742
743
744
745
746
747
# File 'lib/syntax_tree.rb', line 741

def format(q)
  if argument.is_a?(SymbolLiteral)
    q.format(argument.value)
  else
    q.format(argument)
  end
end