Module: Tabulard::Table

Included in:
Adapters::Bare, Adapters::Csv, Adapters::Xlsx
Defined in:
lib/tabulard/table.rb,
lib/tabulard/table/col_converter.rb

Defined Under Namespace

Modules: ClassMethods Classes: Cell, ClosureError, Error, Header, InputError, Row, TooFewHeaders, TooManyHeaders

Constant Summary collapse

Message =
Messaging::MessageVariant
COL_CONVERTER =
ColConverter.new.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#messengerObject (readonly)

Returns the value of attribute messenger.



103
104
105
# File 'lib/tabulard/table.rb', line 103

def messenger
  @messenger
end

Class Method Details

.col2intObject



14
15
16
# File 'lib/tabulard/table.rb', line 14

def self.col2int(...)
  COL_CONVERTER.col2int(...)
end

.int2colObject



18
19
20
# File 'lib/tabulard/table.rb', line 18

def self.int2col(...)
  COL_CONVERTER.int2col(...)
end

Instance Method Details

#closeObject



113
114
115
116
117
118
119
120
121
122
123
# File 'lib/tabulard/table.rb', line 113

def close
  return if closed?

  yield if block_given?

  instance_variables.each { |ivar| remove_instance_variable(ivar) }

  @closed = true

  nil
end

#closed?Boolean

Returns:

  • (Boolean)


125
126
127
# File 'lib/tabulard/table.rb', line 125

def closed?
  @closed == true
end

#each_headerObject

Raises:

  • (NoMethodError)


105
106
107
# File 'lib/tabulard/table.rb', line 105

def each_header
  raise NoMethodError, "You must implement #{self.class}#each_header => self"
end

#each_rowObject

Raises:

  • (NoMethodError)


109
110
111
# File 'lib/tabulard/table.rb', line 109

def each_row
  raise NoMethodError, "You must implement #{self.class}#each_row => self"
end

#initialize(messenger: Messaging::Messenger.new) ⇒ Object



98
99
100
101
# File 'lib/tabulard/table.rb', line 98

def initialize(messenger: Messaging::Messenger.new)
  @messenger = messenger
  @closed = false
end