Class: Cassie::Schema::VersionLoader
- Defined in:
- lib/cassie/schema/version_loader.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#load ⇒ Version, Boolean
Requires the ruby file, thus loading the Migration class into the ObjectSpace.
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
5 6 7 |
# File 'lib/cassie/schema/version_loader.rb', line 5 def filename @filename end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
5 6 7 |
# File 'lib/cassie/schema/version_loader.rb', line 5 def version @version end |
Instance Method Details
#load ⇒ Version, Boolean
Requires the ruby file, thus loading the Migration class into the ObjectSpace.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cassie/schema/version_loader.rb', line 14 def load return false unless filename require filename begin # ensure the migration class is now defined version.migration_class_name.constantize if version.migration.is_a?(Cassie::Schema::Migration) version else false end rescue NameError raise NameError.new("Expected #{version.migration_class_name} to be defined in #{filename}, but it was not.") end end |