Module: AAlib::ArgumentChecks::ClassMethods

Defined in:
lib/aalib.rb

Instance Method Summary collapse

Instance Method Details

#check_hardware_params(hp) ⇒ Object



228
229
230
# File 'lib/aalib.rb', line 228

def check_hardware_params(hp)
  check_type(hp, "hardware_params", AAlib::HardwareParams)
end

#check_render_params(rp) ⇒ Object



232
233
234
# File 'lib/aalib.rb', line 232

def check_render_params(rp)
  check_type(rp, "render_params", AAlib::RenderParams)
end

#check_type(arg, argname, expected) ⇒ Object



220
221
222
223
224
225
226
# File 'lib/aalib.rb', line 220

def check_type(arg, argname, expected)
  if not arg.kind_of?(expected)
    msg = "#{argname}: wrong argument type #{arg.class} "
    msg += "(expected #{expected})"
    raise TypeError.new(msg)
  end
end