Class: PatternMatchingExample::StringWithHello

Inherits:
Object
  • Object
show all
Defined in:
lib/contracts-ruby2/spec/fixtures/fixtures.rb,
lib/contracts-ruby3/spec/fixtures/fixtures.rb

Class Method Summary collapse

Class Method Details

.valid?(string) ⇒ Boolean

Returns:

  • (Boolean)


482
483
484
# File 'lib/contracts-ruby2/spec/fixtures/fixtures.rb', line 482

def self.valid?(string)
  string.is_a?(String) && !!string.match(/hello/i)
end