Class: A11y::Lint::RubyCode
- Inherits:
-
Object
- Object
- A11y::Lint::RubyCode
- 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
-
#call_node ⇒ Object
Returns the Prism::CallNode for the outermost receiverless method call in the code, or nil if none exists.
-
#initialize(code) ⇒ RubyCode
constructor
A new instance of RubyCode.
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_node ⇒ Object
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 |