class GroongaClientModel::Migrator::Definition

Attributes

name[R]
version[R]

Public Class Methods

new(path) click to toggle source
# File lib/groonga_client_model/migrator.rb, line 214
def initialize(path)
  @path = path
  parse_path
end

Public Instance Methods

create_migration(client) click to toggle source
# File lib/groonga_client_model/migrator.rb, line 223
def create_migration(client)
  require(@path)
  @name.camelize.constantize.new(client)
end
valid?() click to toggle source
# File lib/groonga_client_model/migrator.rb, line 219
def valid?
  @version and @name and File.exist?(@path)
end

Private Instance Methods

parse_path() click to toggle source
# File lib/groonga_client_model/migrator.rb, line 229
def parse_path
  if /\A([0-9]+)_([_a-z0-9]+)\.rb\z/ =~ File.basename(@path)
    @version = $1.to_i
    @name = $2
  else
    @version = nil
    @name = nil
  end
end