Class: Magiq::Types::CategoryDepth

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



130
131
132
133
134
135
136
137
138
139
# File 'lib/magiq/types.rb', line 130

def cast!
  v = raw.to_s.to_i

  if v >= 0 && v <= 2
    v
  else
    bad! "provided value of #{raw.inspect} is not a permitted category " \
    "depth, it must be an integer value of 0, 1, or 2."
  end
end