Class: Rant::RantVar::Constraints::Integer

Inherits:
Object
  • Object
show all
Includes:
Constraint
Defined in:
lib/rant/import/var/numbers.rb

Direct Known Subclasses

IntegerInRange

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.rant_constraint(range = nil) ⇒ Object


14
15
16
17
18
19
20
# File 'lib/rant/import/var/numbers.rb', line 14

def rant_constraint(range = nil)
			if range
 IntegerInRange.new(range)
			else
 self.new
			end
end

Instance Method Details

#defaultObject


28
29
30
# File 'lib/rant/import/var/numbers.rb', line 28

def default
    0
end

#filter(val) ⇒ Object


23
24
25
26
27
# File 'lib/rant/import/var/numbers.rb', line 23

def filter(val)
    Kernel::Integer(val)
rescue
    raise ConstraintError.new(self, val)
end

#to_sObject


31
32
33
# File 'lib/rant/import/var/numbers.rb', line 31

def to_s
    "integer"
end