Class: Coopy::CompareFlags
- Inherits:
-
Object
- Object
- Coopy::CompareFlags
- Defined in:
- lib/lib/coopy/compare_flags.rb
Instance Attribute Summary collapse
-
#acts ⇒ Object
Returns the value of attribute acts.
-
#allow_nested_cells ⇒ Object
Returns the value of attribute allow_nested_cells.
-
#always_show_header ⇒ Object
Returns the value of attribute always_show_header.
-
#always_show_order ⇒ Object
Returns the value of attribute always_show_order.
-
#columns_to_ignore ⇒ Object
Returns the value of attribute columns_to_ignore.
-
#count_like_a_spreadsheet ⇒ Object
Returns the value of attribute count_like_a_spreadsheet.
-
#diff_strategy ⇒ Object
Returns the value of attribute diff_strategy.
-
#ids ⇒ Object
Returns the value of attribute ids.
-
#ignore_case ⇒ Object
Returns the value of attribute ignore_case.
-
#ignore_whitespace ⇒ Object
Returns the value of attribute ignore_whitespace.
-
#never_show_order ⇒ Object
Returns the value of attribute never_show_order.
-
#ordered ⇒ Object
Returns the value of attribute ordered.
-
#padding_strategy ⇒ Object
Returns the value of attribute padding_strategy.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#show_meta ⇒ Object
Returns the value of attribute show_meta.
-
#show_unchanged ⇒ Object
Returns the value of attribute show_unchanged.
-
#show_unchanged_columns ⇒ Object
Returns the value of attribute show_unchanged_columns.
-
#show_unchanged_meta ⇒ Object
Returns the value of attribute show_unchanged_meta.
-
#tables ⇒ Object
Returns the value of attribute tables.
-
#unchanged_column_context ⇒ Object
Returns the value of attribute unchanged_column_context.
-
#unchanged_context ⇒ Object
Returns the value of attribute unchanged_context.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Instance Method Summary collapse
- #add_primary_key(column) ⇒ Object
- #add_table(table) ⇒ Object
- #add_warning(warn) ⇒ Object
- #allow_delete ⇒ Object
- #allow_insert ⇒ Object
- #allow_update ⇒ Object
- #filter(act, allow) ⇒ Object
- #get_ignored_columns ⇒ Object
- #get_warning ⇒ Object
- #ignore_column(column) ⇒ Object
-
#initialize ⇒ CompareFlags
constructor
A new instance of CompareFlags.
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 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
#acts ⇒ Object
Returns the value of attribute acts.
39 40 41 |
# File 'lib/lib/coopy/compare_flags.rb', line 39 def acts @acts end |
#allow_nested_cells ⇒ Object
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_header ⇒ Object
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_order ⇒ Object
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_ignore ⇒ Object
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_spreadsheet ⇒ Object
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_strategy ⇒ Object
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 |
#ids ⇒ Object
Returns the value of attribute ids.
40 41 42 |
# File 'lib/lib/coopy/compare_flags.rb', line 40 def ids @ids end |
#ignore_case ⇒ Object
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_whitespace ⇒ Object
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_order ⇒ Object
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 |
#ordered ⇒ Object
Returns the value of attribute ordered.
31 32 33 |
# File 'lib/lib/coopy/compare_flags.rb', line 31 def ordered @ordered end |
#padding_strategy ⇒ Object
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 |
#parent ⇒ Object
Returns the value of attribute parent.
49 50 51 |
# File 'lib/lib/coopy/compare_flags.rb', line 49 def parent @parent end |
#show_meta ⇒ Object
Returns the value of attribute show_meta.
47 48 49 |
# File 'lib/lib/coopy/compare_flags.rb', line 47 def @show_meta end |
#show_unchanged ⇒ Object
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_columns ⇒ Object
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_meta ⇒ Object
Returns the value of attribute show_unchanged_meta.
48 49 50 |
# File 'lib/lib/coopy/compare_flags.rb', line 48 def @show_unchanged_meta end |
#tables ⇒ Object
Returns the value of attribute tables.
42 43 44 |
# File 'lib/lib/coopy/compare_flags.rb', line 42 def tables @tables end |
#unchanged_column_context ⇒ Object
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_context ⇒ Object
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 |
#warnings ⇒ Object
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_delete ⇒ Object
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_insert ⇒ Object
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_update ⇒ Object
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_columns ⇒ Object
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_warning ⇒ Object
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 |