Class: RBS::Types::Literal
- Inherits:
-
Object
- Object
- RBS::Types::Literal
- Includes:
- EmptyEachType, NoFreeVariables, NoSubst, NoTypeName
- Defined in:
- lib/rbs/types.rb
Instance Attribute Summary collapse
-
#literal ⇒ Object
readonly
Returns the value of attribute literal.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #has_classish_type? ⇒ Boolean
- #has_self_type? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(literal:, location:) ⇒ Literal
constructor
A new instance of Literal.
- #to_json(state = _ = nil) ⇒ Object
- #to_s(level = 0) ⇒ Object
- #with_nonreturn_void? ⇒ Boolean
Methods included from NoTypeName
Methods included from EmptyEachType
Methods included from NoSubst
Methods included from NoFreeVariables
Constructor Details
#initialize(literal:, location:) ⇒ Literal
Returns a new instance of Literal.
1359 1360 1361 1362 |
# File 'lib/rbs/types.rb', line 1359 def initialize(literal:, location:) @literal = literal @location = location end |
Instance Attribute Details
#literal ⇒ Object (readonly)
Returns the value of attribute literal.
1356 1357 1358 |
# File 'lib/rbs/types.rb', line 1356 def literal @literal end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
1357 1358 1359 |
# File 'lib/rbs/types.rb', line 1357 def location @location end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
1364 1365 1366 |
# File 'lib/rbs/types.rb', line 1364 def ==(other) other.is_a?(Literal) && other.literal == literal end |
#has_classish_type? ⇒ Boolean
1391 1392 1393 |
# File 'lib/rbs/types.rb', line 1391 def has_classish_type? false end |
#has_self_type? ⇒ Boolean
1387 1388 1389 |
# File 'lib/rbs/types.rb', line 1387 def has_self_type? false end |
#hash ⇒ Object
1370 1371 1372 |
# File 'lib/rbs/types.rb', line 1370 def hash self.class.hash ^ literal.hash end |
#to_json(state = _ = nil) ⇒ Object
1379 1380 1381 |
# File 'lib/rbs/types.rb', line 1379 def to_json(state = _ = nil) { class: :literal, literal: literal.inspect, location: location }.to_json(state) end |
#to_s(level = 0) ⇒ Object
1383 1384 1385 |
# File 'lib/rbs/types.rb', line 1383 def to_s(level = 0) literal.inspect end |
#with_nonreturn_void? ⇒ Boolean
1395 1396 1397 |
# File 'lib/rbs/types.rb', line 1395 def with_nonreturn_void? false end |