Class: CounterModelCreator

Inherits:
Struct
  • Object
show all
Defined in:
lib/multirow_counter/counter_model_creator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#class_nameObject

Returns the value of attribute class_name

Returns:

  • (Object)

    the current value of class_name



1
2
3
# File 'lib/multirow_counter/counter_model_creator.rb', line 1

def class_name
  @class_name
end

#counter_nameObject

Returns the value of attribute counter_name

Returns:

  • (Object)

    the current value of counter_name



1
2
3
# File 'lib/multirow_counter/counter_model_creator.rb', line 1

def counter_name
  @counter_name
end

Instance Method Details

#createObject



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