Method: Class#typed_attr_accessor
- Defined in:
- lib/rusql.rb
#typed_attr_accessor(name, type) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/rusql.rb', line 5 def typed_attr_accessor(name, type) raise TypeException.new(Class, type.class) unless type.is_a?(Class) instance_eval { attr_reader name } define_method "#{name}=", Proc.new { |val| instance_variable_set("@#{name}", val) } end |