Closed gazayas closed 1 year ago
code = <<~CODE :project CODE msmn = Masamune::AbstractSyntaxTree.new(code) msmn.replace(type: :symbols, old_token: "project", new_token: "folder"
We send :symbols to the Masamune::AbstractSyntaxTree object in replace: https://github.com/gazayas/masamune-ast/blob/28d5ffb464148dea699620bebb3c8a33e0ebee98/lib/masamune/slasher.rb#L7
:symbols
Masamune::AbstractSyntaxTree
replace
Writing msmn.symbols makes sense to return an Array of Symbols, but as for the type here in replace, it's more natural to write these in their singular form:
msmn.symbols
type
msmn.replace(type: :symbol, old_token: "project", new_token: "folder"
We send
:symbols
to theMasamune::AbstractSyntaxTree
object inreplace
: https://github.com/gazayas/masamune-ast/blob/28d5ffb464148dea699620bebb3c8a33e0ebee98/lib/masamune/slasher.rb#L7Writing
msmn.symbols
makes sense to return an Array of Symbols, but as for thetype
here inreplace
, it's more natural to write these in their singular form: