class Knish::ExistingModels
Constants
- Data
Public Instance Methods
data()
click to toggle source
# File lib/knish/existing_models.rb, line 15 def data paths.map { |path| Data.new(id(path), path) if id(path) }.compact end
id(path)
click to toggle source
# File lib/knish/existing_models.rb, line 21 def id(path) last = path.split('/').last last && last.to_i end
ids()
click to toggle source
# File lib/knish/existing_models.rb, line 7 def ids paths.map{|path| id(path) }.compact end
next_id()
click to toggle source
# File lib/knish/existing_models.rb, line 3 def next_id (ids.max || 0) + 1 end
paths()
click to toggle source
# File lib/knish/existing_models.rb, line 11 def paths Dir.glob("#{path}/*") end