Class: ActiveRecord::Migration
- Inherits:
-
Object
- Object
- ActiveRecord::Migration
- Defined in:
- lib/ridgepole/migration_ext.rb
Defined Under Namespace
Classes: TimeRecorder
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.record_time ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ridgepole/migration_ext.rb', line 24 def self.record_time result = nil begin self.time_recorder = TimeRecorder.new yield result = self.time_recorder.result ensure self.time_recorder = nil end return result end |
Instance Method Details
#parse_text(text) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ridgepole/migration_ext.rb', line 13 def parse_text(text) return unless self.time_recorder case text when /\A--\s+(.+)\Z/ self.time_recorder.add_key($1) when /\A\s+->\s+(\d+\.\d+)s\Z/ self.time_recorder.add_value($1.to_f) end end |