Class: Magiq::Types::Whole

Inherits:
Type
  • Object
show all
Defined in:
lib/magiq/types.rb

Instance Attribute Summary

Attributes inherited from Type

#raw

Instance Method Summary collapse

Methods inherited from Type

cast, #initialize

Constructor Details

This class inherits a constructor from Magiq::Types::Type

Instance Method Details

#cast!Object



176
177
178
179
180
181
182
183
# File 'lib/magiq/types.rb', line 176

def cast!
  if (v = raw.to_i) >= 0
    v
  else
    bad! "provided value of #{raw.inspect} is not permitted, it must " \
    "be a non-negative number"
  end
end