Class: Prism::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/prism/node_ext.rb,
lib/prism/parse_result/newlines.rb

Instance Method Summary collapse

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("    [deprecation]: \#{self.class}#\#{location} is deprecated and will be \\\n    removed in the next major version. Use \#{suggest.join(\"/\")} instead.\n    \#{(caller(1, 3) || []).join(\"\\n\")}\n  MSG\nend\n", category: :deprecated)

#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:

Returns:

  • (Boolean)


65
66
67
# File 'lib/prism/parse_result/newlines.rb', line 65

def newline_flag? # :nodoc:
  @newline_flag ? true : false
end