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

#initialize ⇒ CompareFlags

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
# 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
end

Instance Attribute Details

#acts ⇒ Object

Returns the value of attribute acts.



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

def acts
  @acts
end

#allow_nested_cells ⇒ Object

Returns the value of attribute allow_nested_cells.



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

def allow_nested_cells
  @allow_nested_cells
end

#always_show_header ⇒ Object

Returns the value of attribute always_show_header.



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

def always_show_header
  @always_show_header
end

#always_show_order ⇒ Object

Returns the value of attribute always_show_order.



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

def always_show_order
  @always_show_order
end

#columns_to_ignore ⇒ Object

Returns the value of attribute columns_to_ignore.



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

def columns_to_ignore
  @columns_to_ignore
end

#count_like_a_spreadsheet ⇒ Object

Returns the value of attribute count_like_a_spreadsheet.



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

def count_like_a_spreadsheet
  @count_like_a_spreadsheet
end

#diff_strategy ⇒ Object

Returns the value of attribute diff_strategy.



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

def diff_strategy
  @diff_strategy
end

#ids ⇒ Object

Returns the value of attribute ids.



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

def ids
  @ids
end

#ignore_whitespace ⇒ Object

Returns the value of attribute ignore_whitespace.



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

def ignore_whitespace
  @ignore_whitespace
end

#never_show_order ⇒ Object

Returns the value of attribute never_show_order.



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

def never_show_order
  @never_show_order
end

#ordered ⇒ Object

Returns the value of attribute ordered.



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

def ordered
  @ordered
end

#parent ⇒ Object

Returns the value of attribute parent.



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

def parent
  @parent
end

#show_meta ⇒ Object

Returns the value of attribute show_meta.



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

def show_meta
  @show_meta
end

#show_unchanged ⇒ Object

Returns the value of attribute show_unchanged.



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

def show_unchanged
  @show_unchanged
end

#show_unchanged_columns ⇒ Object

Returns the value of attribute show_unchanged_columns.



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

def show_unchanged_columns
  @show_unchanged_columns
end

#show_unchanged_meta ⇒ Object

Returns the value of attribute show_unchanged_meta.



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

def show_unchanged_meta
  @show_unchanged_meta
end

#tables ⇒ Object

Returns the value of attribute tables.



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

def tables
  @tables
end

#unchanged_column_context ⇒ Object

Returns the value of attribute unchanged_column_context.



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

def unchanged_column_context
  @unchanged_column_context
end

#unchanged_context ⇒ Object

Returns the value of attribute unchanged_context.



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

def unchanged_context
  @unchanged_context
end

#warnings ⇒ Object

Returns the value of attribute warnings.



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

def warnings
  @warnings
end

Instance Method Details

#add_primary_key(column) ⇒ Object



93
94
95
96
# File 'lib/lib/coopy/compare_flags.rb', line 93

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

#add_table(table) ⇒ Object



103
104
105
106
# File 'lib/lib/coopy/compare_flags.rb', line 103

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

#add_warning(warn) ⇒ Object



108
109
110
111
# File 'lib/lib/coopy/compare_flags.rb', line 108

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

#allow_delete ⇒ Object



73
74
75
76
# File 'lib/lib/coopy/compare_flags.rb', line 73

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

#allow_insert ⇒ Object



68
69
70
71
# File 'lib/lib/coopy/compare_flags.rb', line 68

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

#allow_update ⇒ Object



63
64
65
66
# File 'lib/lib/coopy/compare_flags.rb', line 63

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

#filter(act, allow) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/lib/coopy/compare_flags.rb', line 51

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_columns ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/lib/coopy/compare_flags.rb', line 78

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_warning ⇒ Object



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

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

#ignore_column(column) ⇒ Object



98
99
100
101
# File 'lib/lib/coopy/compare_flags.rb', line 98

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