Class: Typeguard::Validation::Literal

Inherits:
Base
  • Object
show all
Defined in:
lib/typeguard/types.rb

Instance Method Summary collapse

Methods inherited from Base

from

Constructor Details

#initialize(node) ⇒ Literal

Returns a new instance of Literal.



136
137
138
# File 'lib/typeguard/types.rb', line 136

def initialize(node)
  @expected = node.kind.to_s
end

Instance Method Details

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


140
141
142
# File 'lib/typeguard/types.rb', line 140

def valid?(value)
  value.to_s == @expected
end