class RBS::Types::Literal
Constants
- TABLE
Attributes
literal
[R]
literal
location
[R]
loc?
Public Class Methods
(literal: literal, location: loc?) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1534 def initialize(literal:, location:) @literal = literal @location = location end
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1590 def self.unescape_string(string, is_double_quote) if is_double_quote string.gsub!(/\\([0-9]{1,3})/) { ($1 || "").to_i(8).chr } string.gsub!(/\\x([0-9a-f]{1,2})/) { ($1 || "").to_i(16).chr } string.gsub!(/\\u([0-9a-fA-F]{4})/) { ($1 || "").to_i(16).chr(Encoding::UTF_8) } string.gsub!(/\\[abefnrstv"'\\]?/, TABLE) string else string.gsub!(/\\['\\]/, TABLE) string end end
Unescape string type body
Public Instance Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1539 def ==(other) other.is_a?(Literal) && other.literal == literal end
Also aliased as: eql?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1566 def has_classish_type? false end
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1562 def has_self_type? false end
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1545 def hash self.class.hash ^ literal.hash end
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1554 def to_json(state = nil) { class: :literal, literal: literal.inspect, location: location }.to_json(state) end
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1558 def to_s(level = 0) literal.inspect end
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1570 def with_nonreturn_void? false end