Class: Spreadsheetkit::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/spreadsheetkit/cell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(td) ⇒ Cell

Returns a new instance of Cell.



6
7
8
9
10
11
# File 'lib/spreadsheetkit/cell.rb', line 6

def initialize(td)
  @td = td
  @colspan = @td[:colspan].to_i
  @content = @td.content.strip
  @format = Spreadsheetkit::Format.new(@td)
end

Instance Attribute Details

#colspanObject

Returns the value of attribute colspan.



4
5
6
# File 'lib/spreadsheetkit/cell.rb', line 4

def colspan
  @colspan
end

#contentObject

Returns the value of attribute content.



4
5
6
# File 'lib/spreadsheetkit/cell.rb', line 4

def content
  @content
end

#formatObject

Returns the value of attribute format.



4
5
6
# File 'lib/spreadsheetkit/cell.rb', line 4

def format
  @format
end

#tdObject

Returns the value of attribute td.



4
5
6
# File 'lib/spreadsheetkit/cell.rb', line 4

def td
  @td
end

Instance Method Details

#additional_columnsObject



17
18
19
20
21
22
23
# File 'lib/spreadsheetkit/cell.rb', line 17

def additional_columns
  if merge?
    @colspan - 1
  else
    1
  end
end

#merge?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/spreadsheetkit/cell.rb', line 13

def merge?
  @colspan > 1
end