Class: Typeguard::Validation::Duck

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

Instance Method Summary collapse

Methods inherited from Base

from

Constructor Details

#initialize(node) ⇒ Duck

Returns a new instance of Duck.



152
153
154
# File 'lib/typeguard/types.rb', line 152

def initialize(node)
  @name = node.kind[1..]
end

Instance Method Details

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


156
157
158
# File 'lib/typeguard/types.rb', line 156

def valid?(value)
  value.respond_to?(@name)
end