Class: RubyXL::ColumnRange

Inherits:
OOXMLObject show all
Defined in:
lib/rubyXL/objects/column_range.rb

Overview

Constant Summary collapse

DEFAULT_WIDTH =
8

Instance Attribute Summary

Attributes included from OOXMLObjectInstanceMethods

#local_namespaces

Class Method Summary collapse

Instance Method Summary collapse

Methods included from OOXMLObjectInstanceMethods

#==, #before_write_xml, included, #index_in_collection, #initialize, #write_xml

Class Method Details

.chars2raw(width_in_chars) ⇒ Object



34
35
36
# File 'lib/rubyXL/objects/column_range.rb', line 34

def self.chars2raw(width_in_chars)
  ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0
end

Instance Method Details

#delete_column(col_index) ⇒ Object



18
19
20
21
22
# File 'lib/rubyXL/objects/column_range.rb', line 18

def delete_column(col_index)
  col = col_index + 1
  self.min -= 1 if min >= col
  self.max -= 1 if max >= col
end

#include?(col_index) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/rubyXL/objects/column_range.rb', line 30

def include?(col_index)
  ((min - 1)..(max - 1)).include?(col_index)
end

#insert_column(col_index) ⇒ Object



24
25
26
27
28
# File 'lib/rubyXL/objects/column_range.rb', line 24

def insert_column(col_index)
  col = col_index + 1
  self.min += 1 if min >= col
  self.max += 1 if max >= col - 1
end