Class: A11y::Lint::RubyCode

Inherits:
Object
  • Object
show all
Defined in:
lib/a11y/lint/ruby_code.rb

Overview

Represents a Ruby code string extracted from a template. Parses the code with Prism and exposes the resulting CallNode.

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ RubyCode

Returns a new instance of RubyCode.



10
11
12
# File 'lib/a11y/lint/ruby_code.rb', line 10

def initialize(code)
  @code = code
end

Instance Method Details

#call_nodeObject

Returns the Prism::CallNode for the outermost receiverless method call in the code, or nil if none exists.



16
17
18
# File 'lib/a11y/lint/ruby_code.rb', line 16

def call_node
  @call_node ||= parse
end