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.



716
717
718
# File 'lib/syntax_tree.rb', line 716

def initialize(argument)
  @argument = argument
end

Instance Attribute Details

#argumentObject (readonly)

DynaSymbol | SymbolLiteral

the argument being passed to alias



714
715
716
# File 'lib/syntax_tree.rb', line 714

def argument
  @argument
end

Instance Method Details

#commentsObject



720
721
722
723
724
725
726
# File 'lib/syntax_tree.rb', line 720

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

#format(q) ⇒ Object



728
729
730
731
732
733
734
# File 'lib/syntax_tree.rb', line 728

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