Class: GroongaSchema::Diff

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga-schema/diff.rb

Defined Under Namespace

Classes: GroongaCommandListConverter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDiff

Returns a new instance of Diff.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/groonga-schema/diff.rb', line 29

def initialize
  @removed_plugins = []
  @added_plugins = []

  @removed_tables = {}
  @added_tables = {}
  @changed_tables = {}

  @removed_columns = {}
  @added_columns = {}
  @changed_columns = {}
end

Instance Attribute Details

#added_columnsObject (readonly)

Returns the value of attribute added_columns.



27
28
29
# File 'lib/groonga-schema/diff.rb', line 27

def added_columns
  @added_columns
end

#added_pluginsObject (readonly)

Returns the value of attribute added_plugins.



20
21
22
# File 'lib/groonga-schema/diff.rb', line 20

def added_plugins
  @added_plugins
end

#added_tablesObject (readonly)

Returns the value of attribute added_tables.



23
24
25
# File 'lib/groonga-schema/diff.rb', line 23

def added_tables
  @added_tables
end

#changed_columnsObject (readonly)

Returns the value of attribute changed_columns.



28
29
30
# File 'lib/groonga-schema/diff.rb', line 28

def changed_columns
  @changed_columns
end

#changed_tablesObject (readonly)

Returns the value of attribute changed_tables.



24
25
26
# File 'lib/groonga-schema/diff.rb', line 24

def changed_tables
  @changed_tables
end

#removed_columnsObject (readonly)

Returns the value of attribute removed_columns.



26
27
28
# File 'lib/groonga-schema/diff.rb', line 26

def removed_columns
  @removed_columns
end

#removed_pluginsObject (readonly)

Returns the value of attribute removed_plugins.



19
20
21
# File 'lib/groonga-schema/diff.rb', line 19

def removed_plugins
  @removed_plugins
end

#removed_tablesObject (readonly)

Returns the value of attribute removed_tables.



22
23
24
# File 'lib/groonga-schema/diff.rb', line 22

def removed_tables
  @removed_tables
end

Instance Method Details

#==(other) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/groonga-schema/diff.rb', line 42

def ==(other)
  return false unless other.is_a?(self.class)

  @removed_plugins == other.removed_plugins and
    @added_plugins == other.added_plugins and
    @removed_tables == other.removed_tables and
    @added_tables == other.added_tables and
    @changed_tables == other.changed_tables and
    @removed_columns == other.removed_columns and
    @added_columns == other.added_columns and
    @changed_columns == other.changed_columns
end

#same?Boolean

Returns:

  • (Boolean)


55
56
57
58
59
60
61
62
63
64
# File 'lib/groonga-schema/diff.rb', line 55

def same?
  @removed_plugins.empty? and
    @added_plugins.empty? and
    @removed_tables.empty? and
    @added_tables.empty? and
    @changed_tables.empty? and
    @removed_columns.empty? and
    @added_columns.empty? and
    @changed_columns.empty?
end

#to_groonga_command_list(options = {}) ⇒ Object



66
67
68
69
# File 'lib/groonga-schema/diff.rb', line 66

def to_groonga_command_list(options={})
  converter = GroongaCommandListConverter.new(self, options)
  converter.convert
end