Class: GroongaClientModel::Migrator::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga_client_model/migrator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Definition

Returns a new instance of Definition.



214
215
216
217
# File 'lib/groonga_client_model/migrator.rb', line 214

def initialize(path)
  @path = path
  parse_path
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



213
214
215
# File 'lib/groonga_client_model/migrator.rb', line 213

def name
  @name
end

#versionObject (readonly)

Returns the value of attribute version.



212
213
214
# File 'lib/groonga_client_model/migrator.rb', line 212

def version
  @version
end

Instance Method Details

#create_migration(client) ⇒ Object



223
224
225
226
# File 'lib/groonga_client_model/migrator.rb', line 223

def create_migration(client)
  require(@path)
  @name.camelize.constantize.new(client)
end

#valid?Boolean

Returns:

  • (Boolean)


219
220
221
# File 'lib/groonga_client_model/migrator.rb', line 219

def valid?
  @version and @name and File.exist?(@path)
end