Class: RBS::Types::Literal
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
|
|
Inherits: | Object |
Defined in: | lib/rbs/types.rb |
Constant Summary
-
TABLE =
# File 'lib/rbs/types.rb', line 1513{ "\\a" => "\a", "\\b" => "\b", "\\e" => "\033", "\\f" => "\f", "\\n" => "\n", "\\r" => "\r", "\\s" => " ", "\\t" => "\t", "\\v" => "\v", "\\\"" => "\"", "\\\'" => "'", "\\\\" => "\\", "\\" => "" }
Class Method Summary
Instance Attribute Summary
- #has_classish_type? ⇒ Boolean readonly
- #has_self_type? ⇒ Boolean readonly
- #literal readonly
- #location readonly
- #with_nonreturn_void? ⇒ Boolean readonly
Instance Method Summary
- #==(other) (also: #eql?)
- #eql?(other)
- #hash
- #to_json(state = _ = nil)
- #to_s(level = 0)
NoTypeName
- Included
EmptyEachType
- Included
NoSubst
- Included
NoFreeVariables
- Included
Constructor Details
.new(literal:, location:) ⇒ Literal
Class Method Details
.unescape_string(string, is_double_quote)
[ GitHub ]# File 'lib/rbs/types.rb', line 1529
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
Instance Attribute Details
#has_classish_type? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/rbs/types.rb', line 1505
def has_classish_type? false end
#has_self_type? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/rbs/types.rb', line 1501
def has_self_type? false end
#literal (readonly)
[ GitHub ]# File 'lib/rbs/types.rb', line 1470
attr_reader :literal
#location (readonly)
[ GitHub ]# File 'lib/rbs/types.rb', line 1471
attr_reader :location
#with_nonreturn_void? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/rbs/types.rb', line 1509
def with_nonreturn_void? false end
Instance Method Details
#==(other) Also known as: #eql?
[ GitHub ]#eql?(other)
[ GitHub ]# File 'lib/rbs/types.rb', line 1482
alias eql? ==
#hash
[ GitHub ]# File 'lib/rbs/types.rb', line 1484
def hash self.class.hash ^ literal.hash end
#to_json(state = _ = nil)
[ GitHub ]#to_s(level = 0)
[ GitHub ]# File 'lib/rbs/types.rb', line 1497
def to_s(level = 0) literal.inspect end