class RubyXL::ColumnRanges

Public Instance Methods

before_write_xml() click to toggle source
# File lib/rubyXL/objects/column_range.rb, line 68
def before_write_xml
  !(column_ranges.nil? || column_ranges.empty?)
end
find(col_index) click to toggle source
# File lib/rubyXL/objects/column_range.rb, line 60
def find(col_index)
  column_ranges && column_ranges.find { |range| range.include?(col_index) }
end
get_range(col_index) click to toggle source

Locate an existing column range, make a new one if not found, or split existing column range into multiples.

# File lib/rubyXL/objects/column_range.rb, line 43
def get_range(col_index)
  col_num = col_index + 1

  old_range = self.find(col_index)

  if old_range.nil? then
    new_range = RubyXL::ColumnRange.new(:min => col_num, :max => col_num)
    self.column_ranges << new_range
    return new_range
  elsif old_range.min == col_num && 
          old_range.max == col_num then # Single column range, OK to change in place

    return old_range
  else
    raise "Range splitting not implemented yet"
  end
end
insert_column(col_index) click to toggle source
# File lib/rubyXL/objects/column_range.rb, line 64
def insert_column(col_index)
  column_ranges && column_ranges.each { |range| range.insert_column(col_index) }
end