Class: CouchMigrate::BaseExecuter
- Inherits:
-
Object
- Object
- CouchMigrate::BaseExecuter
- Defined in:
- lib/couch_migrate/base_executer.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Namespaced
Instance Method Summary collapse
- #go ⇒ Object
-
#initialize(enabled, str, filename = "") ⇒ BaseExecuter
constructor
A new instance of BaseExecuter.
Constructor Details
#initialize(enabled, str, filename = "") ⇒ BaseExecuter
Returns a new instance of BaseExecuter.
3 4 5 6 7 8 9 |
# File 'lib/couch_migrate/base_executer.rb', line 3 def initialize(enabled, str, filename = "") raise "'enabled' argument must be an Array of symbols (such as [:up, :down] or []" unless enabled.is_a?(Array) @migration_str = str @enabled = enabled @filename = filename self end |
Instance Method Details
#go ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/couch_migrate/base_executer.rb', line 11 def go Namespaced.module_eval(" def self.up\n yield if \#{@enabled.include?(:up)}\n end\n\n def self.down\n yield if \#{@enabled.include?(:down)}\n end\n\n # convenience method for migration files to use\n def self.use_couchrest_model\n require 'couch_migrate/couchrest_model/extend.rb'\n end\n\n EOS\n\n Namespaced.module_eval(@migration_str, @filename)\nend\n", __FILE__, __LINE__ + 1) |