Class: MigrExt::MigrationSet

Inherits:
Object
  • Object
show all
Defined in:
lib/migrext/migration_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, name, path) ⇒ MigrationSet

Returns a new instance of MigrationSet.



5
6
7
8
9
# File 'lib/migrext/migration_set.rb', line 5

def initialize(app, name, path)
    @app = app
    @name = name
    @path = path
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



3
4
5
# File 'lib/migrext/migration_set.rb', line 3

def app
  @app
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/migrext/migration_set.rb', line 3

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/migrext/migration_set.rb', line 3

def path
  @path
end

Instance Method Details

#current_migrationsObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/migrext/migration_set.rb', line 15

def current_migrations
    @current_migrations ||= begin
        Dir["#@path/*"].map do |filename|
            if filename =~ /\d+_\w+\.rb$/
                MigrExt::Migration.new self, filename
            else
                nil
            end
        end.compact
    end
end

#root?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/migrext/migration_set.rb', line 11

def root?
    @name.nil?
end