Class: Contracts::Stringy::Int
- Inherits:
-
Object
- Object
- Contracts::Stringy::Int
- Defined in:
- lib/contracts/stringy.rb
Overview
A string that looks like an integer
Class Method Summary collapse
Class Method Details
.generate(*args) ⇒ Object
20 21 22 |
# File 'lib/contracts/stringy.rb', line 20 def self.generate(*args) Contracts::Builtin::Int.generate(*args).to_s end |
.valid?(value) ⇒ Boolean
16 17 18 |
# File 'lib/contracts/stringy.rb', line 16 def self.valid?(value) value.is_a? String and (value =~ INTEGER_REGEX) != nil end |