Class: Hekenga::DSL::Migration

Inherits:
Hekenga::DSL show all
Defined in:
lib/hekenga/dsl/migration.rb

Instance Attribute Summary

Attributes inherited from Hekenga::DSL

#object

Instance Method Summary collapse

Methods inherited from Hekenga::DSL

build_klass, configures, #description, #initialize

Constructor Details

This class inherits a constructor from Hekenga::DSL

Instance Method Details

#batch_size(size) ⇒ Object



8
9
10
11
12
13
# File 'lib/hekenga/dsl/migration.rb', line 8

def batch_size(size)
  unless size.is_a?(Integer) && size > 0
    raise "Invalid batch size #{size.inspect}"
  end
  @object.batch_size = size
end

#created(stamp = nil) ⇒ Object



15
16
17
# File 'lib/hekenga/dsl/migration.rb', line 15

def created(stamp = nil)
  @object.stamp = Time.parse(stamp)
end

#inspectObject



27
28
29
# File 'lib/hekenga/dsl/migration.rb', line 27

def inspect
  "<#{self.class} - #{@object.description} (#{@object.stamp.strftime("%Y-%m-%d %H:%M")})>"
end

#per_document(description = nil, &block) ⇒ Object



23
24
25
# File 'lib/hekenga/dsl/migration.rb', line 23

def per_document(description = nil, &block)
  @object.tasks.push Hekenga::DSL::DocumentTask.new(description, &block).object
end

#task(description = nil, &block) ⇒ Object



19
20
21
# File 'lib/hekenga/dsl/migration.rb', line 19

def task(description = nil, &block)
  @object.tasks.push Hekenga::DSL::SimpleTask.new(description, &block).object
end