Module: Engineer::Database::SeedHelper
- Defined in:
- lib/engineer/database/seed_helper.rb
Instance Method Summary collapse
- #log(msg, type: :full) ⇒ Object
- #log_section(title) ⇒ Object
- #without_papertrail_versioning_for(klass) ⇒ Object
Instance Method Details
#log(msg, type: :full) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/engineer/database/seed_helper.rb', line 8 def log(msg, type: :full) case type when :full print "-----> #{msg}" if block_given? ms = Benchmark.ms { yield } milliseconds = "#{ms.to_i}ms" print "\r-----> #{milliseconds.ljust(8, ' ')} #{msg}" end print "\n" when :sub puts " #{msg}" else raise "Unknown type #{type}" end end |
#log_section(title) ⇒ Object
25 26 27 28 29 |
# File 'lib/engineer/database/seed_helper.rb', line 25 def log_section(title) log "-" * 80 log title log "-" * 80 end |
#without_papertrail_versioning_for(klass) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/engineer/database/seed_helper.rb', line 31 def without_papertrail_versioning_for(klass) raise ArgumentError unless klass.is_a? Class klass.paper_trail.disable yield klass.paper_trail.enable end |