Class: Magiq::Types::ID

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



82
83
84
85
86
87
88
89
90
91
# File 'lib/magiq/types.rb', line 82

def cast!
  v = raw.to_i

  if v > 0
    v
  else
    bad! "provided value of #{raw.inspect} is not permitted, it must " \
    "be a numerical ID greater than zero."
  end
end