Class: Coopy::CompareFlags

Inherits:
Object
  • Object
show all
Defined in:
lib/lib/coopy/compare_flags.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCompareFlags

Returns a new instance of CompareFlags.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/lib/coopy/compare_flags.rb', line 7

def initialize
  @ordered = true
  @show_unchanged = false
  @unchanged_context = 1
  @always_show_order = false
  @never_show_order = true
  @show_unchanged_columns = false
  @unchanged_column_context = 1
  @always_show_header = true
  @acts = nil
  @ids = nil
  @columns_to_ignore = nil
  @allow_nested_cells = false
  @warnings = nil
  @diff_strategy = nil
  @show_meta = true
  @show_unchanged_meta = false
  @tables = nil
  @parent = nil
  @count_like_a_spreadsheet = true
  @ignore_whitespace = false
  @ignore_case = false
end

Instance Attribute Details

#actsObject

Returns the value of attribute acts.



39
40
41
# File 'lib/lib/coopy/compare_flags.rb', line 39

def acts
  @acts
end

#allow_nested_cellsObject

Returns the value of attribute allow_nested_cells.



43
44
45
# File 'lib/lib/coopy/compare_flags.rb', line 43

def allow_nested_cells
  @allow_nested_cells
end

#always_show_headerObject

Returns the value of attribute always_show_header.



38
39
40
# File 'lib/lib/coopy/compare_flags.rb', line 38

def always_show_header
  @always_show_header
end

#always_show_orderObject

Returns the value of attribute always_show_order.



34
35
36
# File 'lib/lib/coopy/compare_flags.rb', line 34

def always_show_order
  @always_show_order
end

#columns_to_ignoreObject

Returns the value of attribute columns_to_ignore.



41
42
43
# File 'lib/lib/coopy/compare_flags.rb', line 41

def columns_to_ignore
  @columns_to_ignore
end

#count_like_a_spreadsheetObject

Returns the value of attribute count_like_a_spreadsheet.



50
51
52
# File 'lib/lib/coopy/compare_flags.rb', line 50

def count_like_a_spreadsheet
  @count_like_a_spreadsheet
end

#diff_strategyObject

Returns the value of attribute diff_strategy.



45
46
47
# File 'lib/lib/coopy/compare_flags.rb', line 45

def diff_strategy
  @diff_strategy
end

#idsObject

Returns the value of attribute ids.



40
41
42
# File 'lib/lib/coopy/compare_flags.rb', line 40

def ids
  @ids
end

#ignore_caseObject

Returns the value of attribute ignore_case.



52
53
54
# File 'lib/lib/coopy/compare_flags.rb', line 52

def ignore_case
  @ignore_case
end

#ignore_whitespaceObject

Returns the value of attribute ignore_whitespace.



51
52
53
# File 'lib/lib/coopy/compare_flags.rb', line 51

def ignore_whitespace
  @ignore_whitespace
end

#never_show_orderObject

Returns the value of attribute never_show_order.



35
36
37
# File 'lib/lib/coopy/compare_flags.rb', line 35

def never_show_order
  @never_show_order
end

#orderedObject

Returns the value of attribute ordered.



31
32
33
# File 'lib/lib/coopy/compare_flags.rb', line 31

def ordered
  @ordered
end

#padding_strategyObject

Returns the value of attribute padding_strategy.



46
47
48
# File 'lib/lib/coopy/compare_flags.rb', line 46

def padding_strategy
  @padding_strategy
end

#parentObject

Returns the value of attribute parent.



49
50
51
# File 'lib/lib/coopy/compare_flags.rb', line 49

def parent
  @parent
end

#show_metaObject

Returns the value of attribute show_meta.



47
48
49
# File 'lib/lib/coopy/compare_flags.rb', line 47

def show_meta
  @show_meta
end

#show_unchangedObject

Returns the value of attribute show_unchanged.



32
33
34
# File 'lib/lib/coopy/compare_flags.rb', line 32

def show_unchanged
  @show_unchanged
end

#show_unchanged_columnsObject

Returns the value of attribute show_unchanged_columns.



36
37
38
# File 'lib/lib/coopy/compare_flags.rb', line 36

def show_unchanged_columns
  @show_unchanged_columns
end

#show_unchanged_metaObject

Returns the value of attribute show_unchanged_meta.



48
49
50
# File 'lib/lib/coopy/compare_flags.rb', line 48

def show_unchanged_meta
  @show_unchanged_meta
end

#tablesObject

Returns the value of attribute tables.



42
43
44
# File 'lib/lib/coopy/compare_flags.rb', line 42

def tables
  @tables
end

#unchanged_column_contextObject

Returns the value of attribute unchanged_column_context.



37
38
39
# File 'lib/lib/coopy/compare_flags.rb', line 37

def unchanged_column_context
  @unchanged_column_context
end

#unchanged_contextObject

Returns the value of attribute unchanged_context.



33
34
35
# File 'lib/lib/coopy/compare_flags.rb', line 33

def unchanged_context
  @unchanged_context
end

#warningsObject

Returns the value of attribute warnings.



44
45
46
# File 'lib/lib/coopy/compare_flags.rb', line 44

def warnings
  @warnings
end

Instance Method Details

#add_primary_key(column) ⇒ Object



96
97
98
99
# File 'lib/lib/coopy/compare_flags.rb', line 96

def add_primary_key(column)
  @ids = Array.new if @ids == nil
  @ids.push(column)
end

#add_table(table) ⇒ Object



106
107
108
109
# File 'lib/lib/coopy/compare_flags.rb', line 106

def add_table(table)
  @tables = Array.new if @tables == nil
  @tables.push(table)
end

#add_warning(warn) ⇒ Object



111
112
113
114
# File 'lib/lib/coopy/compare_flags.rb', line 111

def add_warning(warn)
  @warnings = Array.new if @warnings == nil
  @warnings.push(warn)
end

#allow_deleteObject



76
77
78
79
# File 'lib/lib/coopy/compare_flags.rb', line 76

def allow_delete 
  return true if @acts == nil
  @acts.include?("delete")
end

#allow_insertObject



71
72
73
74
# File 'lib/lib/coopy/compare_flags.rb', line 71

def allow_insert 
  return true if @acts == nil
  @acts.include?("insert")
end

#allow_updateObject



66
67
68
69
# File 'lib/lib/coopy/compare_flags.rb', line 66

def allow_update 
  return true if @acts == nil
  @acts.include?("update")
end

#filter(act, allow) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/lib/coopy/compare_flags.rb', line 54

def filter(act,allow)
  if @acts == nil 
    @acts = {}
    @acts["update"] = !allow
    @acts["insert"] = !allow
    @acts["delete"] = !allow
  end
  return false if !@acts.include?(act)
  @acts[act] = allow
  true
end

#get_ignored_columnsObject



81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/lib/coopy/compare_flags.rb', line 81

def get_ignored_columns 
  return nil if @columns_to_ignore == nil
  ignore = {}
  begin
    _g1 = 0
    _g = @columns_to_ignore.length
    while(_g1 < _g) 
      i = _g1
      _g1+=1
      ignore[@columns_to_ignore[i]] = true
    end
  end
  ignore
end

#get_warningObject



116
117
118
# File 'lib/lib/coopy/compare_flags.rb', line 116

def get_warning 
  @warnings.join("\n")
end

#ignore_column(column) ⇒ Object



101
102
103
104
# File 'lib/lib/coopy/compare_flags.rb', line 101

def ignore_column(column)
  @columns_to_ignore = Array.new if @columns_to_ignore == nil
  @columns_to_ignore.push(column)
end