class OneOff::File
Constants
- REGEX
Attributes
filename[R]
Public Class Methods
all()
click to toggle source
# File lib/one_off/file.rb, line 10 def all Dir.glob('db/one_off/*.rb', base: Rails.root) .map { |f| ::File.basename(f, '.rb') } .select { |f| REGEX.match(f) } .map { |f| new(f) } end
find(id)
click to toggle source
# File lib/one_off/file.rb, line 17 def find(id) all.find { |file| file.id == id.to_i } end
new(filename)
click to toggle source
# File lib/one_off/file.rb, line 24 def initialize(filename) @filename = filename end
Public Instance Methods
file_name_match()
click to toggle source
# File lib/one_off/file.rb, line 28 def file_name_match @file_name_match ||= REGEX.match(filename) end
task_name()
click to toggle source
# File lib/one_off/file.rb, line 38 def task_name file_name_match[2] end
version()
click to toggle source
# File lib/one_off/file.rb, line 32 def version file_name_match[1].to_i end
Also aliased as: id