class StrongJSON::Type::Literal
Attributes
value[R]
@dynamic value
Public Class Methods
new(value)
click to toggle source
# File lib/strong_json/type.rb, line 129 def initialize(value) @value = value end
Public Instance Methods
==(other)
click to toggle source
# File lib/strong_json/type.rb, line 142 def ==(other) if other.is_a?(Literal) other.value == value end end
Also aliased as: eql?
coerce(value, path: ErrorPath.root(self))
click to toggle source
# File lib/strong_json/type.rb, line 137 def coerce(value, path: ErrorPath.root(self)) raise TypeError.new(path: path, value: value) unless (_ = self.value) == value value end
to_s()
click to toggle source
# File lib/strong_json/type.rb, line 133 def to_s self.alias&.to_s || (_ = @value).inspect end