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
- @@log =
self.init_logger
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.
Instance Method Summary collapse
- #col ⇒ Object
-
#initialize(row = nil, col = nil, value = nil) ⇒ Cell
constructor
A new instance of Cell.
- #line(num = nil) ⇒ Object
- #resize ⇒ Object
- #row ⇒ Object
- #to_cell ⇒ Object
- #to_s ⇒ Object
Methods included from Logging
init_logger, log_level=, log_target=
Methods included from File_Checking
Constructor Details
#initialize(row = nil, col = nil, value = nil) ⇒ Cell
Returns a new instance of Cell.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/cell.rb', line 38 def initialize(row = nil, col = nil, value = nil) @log = @@log @row = row if row @col = col if col @type_class = @@DEF_TYPE @value = value split_value set_limits @row.resize @log.debug("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.
84 85 86 |
# File 'lib/cell.rb', line 84 def ideal_height @ideal_height end |
#ideal_width ⇒ Object (readonly)
Returns the value of attribute ideal_width.
84 85 86 |
# File 'lib/cell.rb', line 84 def ideal_width @ideal_width end |
#value ⇒ Object
Returns the value of attribute value.
84 85 86 |
# File 'lib/cell.rb', line 84 def value @value end |
Instance Method Details
#col ⇒ Object
76 77 78 |
# File 'lib/cell.rb', line 76 def col @col.number end |
#line(num = nil) ⇒ Object
54 55 56 |
# File 'lib/cell.rb', line 54 def line(num = nil) num && num < @lines.length ? @lines[num].to_s : ' ' if @lines && !@lines.empty? end |
#resize ⇒ Object
62 63 64 65 66 67 |
# File 'lib/cell.rb', line 62 def resize @@split_pattern = nil split_value set_limits @row.resize end |
#row ⇒ Object
80 81 82 |
# File 'lib/cell.rb', line 80 def row @row.number end |
#to_cell ⇒ Object
50 51 52 |
# File 'lib/cell.rb', line 50 def to_cell() self end |
#to_s ⇒ Object
58 59 60 |
# File 'lib/cell.rb', line 58 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 |