Class: Rant::RantVar::Constraints::Float

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

Direct Known Subclasses

FloatInRange

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.rant_constraint(range = nil) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/rant/import/var/numbers.rb', line 60

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

Instance Method Details

#defaultObject



74
75
76
# File 'lib/rant/import/var/numbers.rb', line 74

def default
    0.0
end

#filter(val) ⇒ Object



69
70
71
72
73
# File 'lib/rant/import/var/numbers.rb', line 69

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

#to_sObject



77
78
79
# File 'lib/rant/import/var/numbers.rb', line 77

def to_s
    "float"
end