Class: XMigra::Index

Inherits:
Object show all
Defined in:
lib/xmigra/index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index_info) ⇒ Index

Returns a new instance of Index.



5
6
7
8
# File 'lib/xmigra/index.rb', line 5

def initialize(index_info)
  @name = index_info['name'].dup.freeze
  @definition = index_info['sql'].dup.freeze
end

Instance Attribute Details

#file_pathObject

Returns the value of attribute file_path.



12
13
14
# File 'lib/xmigra/index.rb', line 12

def file_path
  @file_path
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/xmigra/index.rb', line 10

def name
  @name
end

Instance Method Details

#definition_sqlObject



18
19
20
21
22
23
24
25
26
# File 'lib/xmigra/index.rb', line 18

def definition_sql
  if Plugin.active
    @definition.dup.tap do |sql|
      Plugin.active.amend_source_sql(sql)
    end
  else
    @definition
  end
end

#idObject



14
15
16
# File 'lib/xmigra/index.rb', line 14

def id
  XMigra.secure_digest(@definition)
end