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.



678
679
680
# File 'lib/syntax_tree.rb', line 678

def initialize(argument)
  @argument = argument
end

Instance Attribute Details

#argumentObject (readonly)

DynaSymbol | SymbolLiteral

the argument being passed to alias



676
677
678
# File 'lib/syntax_tree.rb', line 676

def argument
  @argument
end

Instance Method Details

#commentsObject



682
683
684
685
686
687
688
# File 'lib/syntax_tree.rb', line 682

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

#format(q) ⇒ Object



690
691
692
693
694
695
696
# File 'lib/syntax_tree.rb', line 690

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