Class: MigrExt::MigrationSet
- Inherits:
-
Object
- Object
- MigrExt::MigrationSet
- Defined in:
- lib/migrext/migration_set.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #current_migrations ⇒ Object
-
#initialize(app, name, path) ⇒ MigrationSet
constructor
A new instance of MigrationSet.
- #root? ⇒ Boolean
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
#app ⇒ Object (readonly)
Returns the value of attribute app.
3 4 5 |
# File 'lib/migrext/migration_set.rb', line 3 def app @app end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/migrext/migration_set.rb', line 3 def name @name end |
#path ⇒ Object (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_migrations ⇒ Object
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
11 12 13 |
# File 'lib/migrext/migration_set.rb', line 11 def root? @name.nil? end |