Module: SimpleDataMigrations::Utils
- Defined in:
- lib/simple_data_migrations/utils.rb
Class Method Summary collapse
- .humanize_filename(filename) ⇒ Object
- .ran_versions ⇒ Object
- .root ⇒ Object
- .script_files ⇒ Object
- .version(filename) ⇒ Object
Class Method Details
.humanize_filename(filename) ⇒ Object
21 22 23 24 25 |
# File 'lib/simple_data_migrations/utils.rb', line 21 def self.humanize_filename(filename) return "********** NO FILE **********" unless filename filename.delete_prefix(version(filename)).delete_suffix(".rb").humanize end |
.ran_versions ⇒ Object
9 10 11 |
# File 'lib/simple_data_migrations/utils.rb', line 9 def self.ran_versions Entry.pluck(:version) end |
.root ⇒ Object
13 14 15 |
# File 'lib/simple_data_migrations/utils.rb', line 13 def self.root Rails.root.join("db/data") end |
.script_files ⇒ Object
5 6 7 |
# File 'lib/simple_data_migrations/utils.rb', line 5 def self.script_files Dir.children(root).sort end |
.version(filename) ⇒ Object
17 18 19 |
# File 'lib/simple_data_migrations/utils.rb', line 17 def self.version(filename) filename.split("_", 2).first end |