Class: Cell
Overview
Objects of this class represent cells in a spreadsheet table
Constant Summary collapse
- @@DEF_HEIGHT =
1- @@DEF_TYPE =
Integer- @@split_pattern =
nil
Constants included from BasicLogging
BasicLogging::DEBUG, BasicLogging::ERROR, BasicLogging::FATAL, BasicLogging::INFO, BasicLogging::Levels, BasicLogging::UNKNOWN, BasicLogging::WARN
Instance Attribute Summary collapse
-
#ideal_height ⇒ Object
readonly
Returns the value of attribute ideal_height.
-
#ideal_width ⇒ Object
readonly
Returns the value of attribute ideal_width.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes included from BasicLogging
Instance Method Summary collapse
-
#col ⇒ Object
returns the column number of the cell.
-
#initialize(row = nil, col = nil, value = nil) ⇒ Cell
constructor
create a cell in co:row and enter a value.
-
#line(num = nil) ⇒ Object
return a line from the cell.
-
#resize ⇒ Object
resizes the cell to its ideal value.
-
#row ⇒ Object
returns the row number of the cell.
-
#to_cell ⇒ Object
returns self.
-
#to_s ⇒ Object
returns a string representation of the cell.
Methods included from BasicLogging
is_muted?, #log, mute, #set_level, set_level, set_target, #set_target
Constructor Details
#initialize(row = nil, col = nil, value = nil) ⇒ Cell
create a cell in co:row and enter a value
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cell.rb', line 30 def initialize(row = nil, col = nil, value = nil) @row = row if row @col = col if col @debinfo = '(' << @col.number.to_s << ':' << @row.number.to_s << ') ' @type_class = @@DEF_TYPE @value = value split_value set_limits @row.resize debug(@debinfo << "cell.initialize, lines is #{@lines}, value is #{value}, ideal_width is #{@ideal_width}") end |
Instance Attribute Details
#ideal_height ⇒ Object (readonly)
Returns the value of attribute ideal_height.
83 84 85 |
# File 'lib/cell.rb', line 83 def ideal_height @ideal_height end |
#ideal_width ⇒ Object (readonly)
Returns the value of attribute ideal_width.
83 84 85 |
# File 'lib/cell.rb', line 83 def ideal_width @ideal_width end |
#value ⇒ Object
Returns the value of attribute value.
83 84 85 |
# File 'lib/cell.rb', line 83 def value @value end |
Instance Method Details
#col ⇒ Object
returns the column number of the cell
74 75 76 |
# File 'lib/cell.rb', line 74 def col @col.number end |
#line(num = nil) ⇒ Object
return a line from the cell
48 49 50 |
# File 'lib/cell.rb', line 48 def line(num = nil) num && num < @lines.length ? @lines[num].to_s : ' ' if @lines && !@lines.empty? end |
#resize ⇒ Object
resizes the cell to its ideal value.
58 59 60 61 62 63 |
# File 'lib/cell.rb', line 58 def resize @@split_pattern = nil split_value set_limits @row.resize end |
#row ⇒ Object
returns the row number of the cell
79 80 81 |
# File 'lib/cell.rb', line 79 def row @row.number end |
#to_cell ⇒ Object
returns self
43 44 45 |
# File 'lib/cell.rb', line 43 def to_cell() self end |
#to_s ⇒ Object
returns a string representation of the cell
53 54 55 |
# File 'lib/cell.rb', line 53 def to_s object_id.to_s << "{" << @row.number.to_s << ":" << @col.number.to_s << ", " << @lines.to_s << ", " << @ideal_height.to_s << ", " << @ideal_width.to_s << " }" end |