Class: Colonization::Colonizer
- Inherits:
-
Object
- Object
- Colonization::Colonizer
- Defined in:
- lib/colonization/colonizer.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
Returns the value of attribute model.
Instance Method Summary collapse
- #clear_table ⇒ Object
- #colonize(times = nil) ⇒ Object
-
#initialize(model) ⇒ Colonizer
constructor
A new instance of Colonizer.
- #print_action ⇒ Object
Constructor Details
#initialize(model) ⇒ Colonizer
Returns a new instance of Colonizer.
9 10 11 |
# File 'lib/colonization/colonizer.rb', line 9 def initialize(model) @model = model end |
Instance Attribute Details
#model ⇒ Object
Returns the value of attribute model.
7 8 9 |
# File 'lib/colonization/colonizer.rb', line 7 def model @model end |
Instance Method Details
#clear_table ⇒ Object
25 26 27 |
# File 'lib/colonization/colonizer.rb', line 25 def clear_table model.destroy_all if clear_table? end |
#colonize(times = nil) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/colonization/colonizer.rb', line 17 def colonize(times = nil) res = [] (times || model_instances_number).times do res << model.create!(params_with_values) end res end |
#print_action ⇒ Object
13 14 15 |
# File 'lib/colonization/colonizer.rb', line 13 def print_action puts "colonize #{model}" end |