class Prism::MagicComment
This represents a magic comment that was encountered during parsing.
This represents a magic comment that was encountered during parsing.
Attributes
key_loc
[R]
Location
value_loc
[R]
Location
Public Class Methods
(Location key_loc, Location value_loc) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/parse_result.rb, line 796 def initialize(key_loc, value_loc) @key_loc = key_loc @value_loc = value_loc end
Public Instance Methods
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/parse_result.rbs, line 573
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
Implement the hash pattern matching interface for MagicComment.
: (Array? keys) -> Hash[Symbol, untyped]
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/parse_result.rbs, line 578
def inspect: () -> String
Returns a string representation of this magic comment.
: () -> String
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/parse_result.rb, line 804 def key key_loc.slice end
Returns the key of the magic comment by slicing it from the source code.
Returns the key of the magic comment by slicing it from the source code.
: () -> String
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/parse_result.rb, line 811 def value value_loc.slice end
Returns the value of the magic comment by slicing it from the source code.
Returns the value of the magic comment by slicing it from the source code.
: () -> String