Class: Prism::Node
- Inherits:
-
Object
- Object
- Prism::Node
- Defined in:
- lib/prism/node_ext.rb,
lib/prism/parse_result/newlines.rb
Direct Known Subclasses
BeginNode, CallNode, CallOperatorWriteNode, CaseMatchNode, CaseNode, ClassVariableOperatorWriteNode, ConstantOperatorWriteNode, ConstantPathNode, ConstantPathOperatorWriteNode, ConstantPathTargetNode, ConstantReadNode, ConstantTargetNode, ConstantWriteNode, GlobalVariableOperatorWriteNode, IfNode, ImaginaryNode, IndexOperatorWriteNode, InstanceVariableOperatorWriteNode, InterpolatedMatchLastLineNode, InterpolatedRegularExpressionNode, InterpolatedStringNode, InterpolatedSymbolNode, InterpolatedXStringNode, LocalVariableOperatorWriteNode, MatchLastLineNode, ParametersNode, ParenthesesNode, RationalNode, RegularExpressionNode, RescueModifierNode, RescueNode, StringNode, UnlessNode, UntilNode, WhileNode, XStringNode
Instance Method Summary collapse
-
#deprecated(*replacements) ⇒ Object
:nodoc:.
-
#newline_flag!(lines) ⇒ Object
:nodoc:.
-
#newline_flag? ⇒ Boolean
:nodoc:.
Instance Method Details
#deprecated(*replacements) ⇒ Object
:nodoc:
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/prism/node_ext.rb', line 7 def deprecated(*replacements) # :nodoc: location = caller_locations(1, 1) location = location[0].label if location suggest = replacements.map { |replacement| "#{self.class}##{replacement}" } warn(<<~MSG, category: :deprecated) [deprecation]: #{self.class}##{location} is deprecated and will be \ removed in the next major version. Use #{suggest.join("/")} instead. #{(caller(1, 3) || []).join("\n")} MSG end |
#newline_flag!(lines) ⇒ Object
:nodoc:
69 70 71 72 73 74 75 |
# File 'lib/prism/parse_result/newlines.rb', line 69 def newline_flag!(lines) # :nodoc: line = location.start_line unless lines[line] lines[line] = true @newline_flag = true end end |
#newline_flag? ⇒ Boolean
:nodoc:
65 66 67 |
# File 'lib/prism/parse_result/newlines.rb', line 65 def newline_flag? # :nodoc: @newline_flag ? true : false end |