Class: Charty::TableAdapters::BaseAdapter

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable
Defined in:
lib/charty/table_adapters/base_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



9
10
11
# File 'lib/charty/table_adapters/base_adapter.rb', line 9

def columns
  @columns
end

#indexObject

Returns the value of attribute index.



19
20
21
# File 'lib/charty/table_adapters/base_adapter.rb', line 19

def index
  @index
end

Instance Method Details

#==(other) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/charty/table_adapters/base_adapter.rb', line 25

def ==(other)
  case other
  when BaseAdapter
    return false if columns != other.columns
    return false if index != other.index
    compare_data_equality(other)
  else
    false
  end
end

#column_namesObject



15
16
17
# File 'lib/charty/table_adapters/base_adapter.rb', line 15

def column_names
  columns.to_a
end

#compare_data_equality(other) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/charty/table_adapters/base_adapter.rb', line 36

def compare_data_equality(other)
  columns.each do |name|
    if self[nil, name] != other[nil, name]
      return false
    end
  end
  true
end