Class: Lhm::Migration

Inherits:
Object
  • Object
show all
Defined in:
lib/lhm/migration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(origin, destination, conditions = nil, renames = {}, time = Time.now) ⇒ Migration


10
11
12
13
14
15
16
# File 'lib/lhm/migration.rb', line 10

def initialize(origin, destination, conditions = nil, renames = {}, time = Time.now)
  @origin = origin
  @destination = destination
  @conditions = conditions
  @start = time
  @renames = renames
end

Instance Attribute Details

#conditionsObject (readonly)

Returns the value of attribute conditions


8
9
10
# File 'lib/lhm/migration.rb', line 8

def conditions
  @conditions
end

#destinationObject (readonly)

Returns the value of attribute destination


8
9
10
# File 'lib/lhm/migration.rb', line 8

def destination
  @destination
end

#originObject (readonly)

Returns the value of attribute origin


8
9
10
# File 'lib/lhm/migration.rb', line 8

def origin
  @origin
end

#renamesObject (readonly)

Returns the value of attribute renames


8
9
10
# File 'lib/lhm/migration.rb', line 8

def renames
  @renames
end

Instance Method Details

#archive_nameObject


18
19
20
# File 'lib/lhm/migration.rb', line 18

def archive_name
  "lhma_#{ startstamp }_#{ @origin.name }"[0...64]
end

#intersectionObject


22
23
24
# File 'lib/lhm/migration.rb', line 22

def intersection
  Intersection.new(@origin, @destination, @renames)
end

#startstampObject


26
27
28
# File 'lib/lhm/migration.rb', line 26

def startstamp
  @start.strftime "%Y_%m_%d_%H_%M_%S_#{ '%03d' % (@start.usec / 1000) }"
end