Module: EnumeratedAttribute::Integrations::Default::ClassMethods

Defined in:
lib/enumerated_attribute/integrations/default.rb

Instance Method Summary collapse

Instance Method Details

#define_enumerated_attribute_reader_method(name) ⇒ Object



15
16
17
18
19
20
# File 'lib/enumerated_attribute/integrations/default.rb', line 15

def define_enumerated_attribute_reader_method(name)
	name = name.to_sym
	class_eval do
		define_method(name) { read_enumerated_attribute(name) }
      end
end

#define_enumerated_attribute_writer_method(name) ⇒ Object



8
9
10
11
12
13
# File 'lib/enumerated_attribute/integrations/default.rb', line 8

def define_enumerated_attribute_writer_method(name)
	method_name = "#{name}=".to_sym
	class_eval do
		define_method(method_name) {|val| write_enumerated_attribute(name.to_sym, val) }
      end
end