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
30
31
# 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
  @terminal_format = nil
  @use_glyphs = true
end

Instance Attribute Details

#actsObject

Returns the value of attribute acts.



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

def acts
  @acts
end

#allow_nested_cellsObject

Returns the value of attribute allow_nested_cells.



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

def allow_nested_cells
  @allow_nested_cells
end

#always_show_headerObject

Returns the value of attribute always_show_header.



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

def always_show_header
  @always_show_header
end

#always_show_orderObject

Returns the value of attribute always_show_order.



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

def always_show_order
  @always_show_order
end

#columns_to_ignoreObject

Returns the value of attribute columns_to_ignore.



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

def columns_to_ignore
  @columns_to_ignore
end

#count_like_a_spreadsheetObject

Returns the value of attribute count_like_a_spreadsheet.



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

def count_like_a_spreadsheet
  @count_like_a_spreadsheet
end

#diff_strategyObject

Returns the value of attribute diff_strategy.



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

def diff_strategy
  @diff_strategy
end

#idsObject

Returns the value of attribute ids.



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

def ids
  @ids
end

#ignore_caseObject

Returns the value of attribute ignore_case.



54
55
56
# File 'lib/lib/coopy/compare_flags.rb', line 54

def ignore_case
  @ignore_case
end

#ignore_whitespaceObject

Returns the value of attribute ignore_whitespace.



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

def ignore_whitespace
  @ignore_whitespace
end

#never_show_orderObject

Returns the value of attribute never_show_order.



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

def never_show_order
  @never_show_order
end

#orderedObject

Returns the value of attribute ordered.



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

def ordered
  @ordered
end

#padding_strategyObject

Returns the value of attribute padding_strategy.



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

def padding_strategy
  @padding_strategy
end

#parentObject

Returns the value of attribute parent.



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

def parent
  @parent
end

#show_metaObject

Returns the value of attribute show_meta.



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

def show_meta
  @show_meta
end

#show_unchangedObject

Returns the value of attribute show_unchanged.



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

def show_unchanged
  @show_unchanged
end

#show_unchanged_columnsObject

Returns the value of attribute show_unchanged_columns.



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

def show_unchanged_columns
  @show_unchanged_columns
end

#show_unchanged_metaObject

Returns the value of attribute show_unchanged_meta.



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

def show_unchanged_meta
  @show_unchanged_meta
end

#tablesObject

Returns the value of attribute tables.



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

def tables
  @tables
end

#terminal_formatObject

Returns the value of attribute terminal_format.



55
56
57
# File 'lib/lib/coopy/compare_flags.rb', line 55

def terminal_format
  @terminal_format
end

#unchanged_column_contextObject

Returns the value of attribute unchanged_column_context.



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

def unchanged_column_context
  @unchanged_column_context
end

#unchanged_contextObject

Returns the value of attribute unchanged_context.



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

def unchanged_context
  @unchanged_context
end

#use_glyphsObject

Returns the value of attribute use_glyphs.



56
57
58
# File 'lib/lib/coopy/compare_flags.rb', line 56

def use_glyphs
  @use_glyphs
end

#warningsObject

Returns the value of attribute warnings.



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

def warnings
  @warnings
end

Instance Method Details

#add_primary_key(column) ⇒ Object



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

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

#add_table(table) ⇒ Object



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

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

#add_warning(warn) ⇒ Object



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

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

#allow_deleteObject



80
81
82
83
# File 'lib/lib/coopy/compare_flags.rb', line 80

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

#allow_insertObject



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

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

#allow_updateObject



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

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

#filter(act, allow) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/lib/coopy/compare_flags.rb', line 58

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



85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/lib/coopy/compare_flags.rb', line 85

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



120
121
122
# File 'lib/lib/coopy/compare_flags.rb', line 120

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

#ignore_column(column) ⇒ Object



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

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