Class: CounterModelCreator
- Inherits:
-
Struct
- Object
- Struct
- CounterModelCreator
- Defined in:
- lib/multirow_counter/counter_model_creator.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
Returns the value of attribute class_name.
-
#counter_name ⇒ Object
Returns the value of attribute counter_name.
Instance Method Summary collapse
Instance Attribute Details
#class_name ⇒ Object
Returns the value of attribute class_name
1 2 3 |
# File 'lib/multirow_counter/counter_model_creator.rb', line 1 def class_name @class_name end |
#counter_name ⇒ Object
Returns the value of attribute counter_name
1 2 3 |
# File 'lib/multirow_counter/counter_model_creator.rb', line 1 def counter_name @counter_name end |
Instance Method Details
#create ⇒ Object
2 3 4 5 6 |
# File 'lib/multirow_counter/counter_model_creator.rb', line 2 def create counter_class = Class.new(ActiveRecord::Base) const_name = [class_name, counter_name.classify].join MultirowCounter.const_set(const_name, counter_class) end |