Class: Rbxl::WriteOnlyCell
- Inherits:
-
Object
- Object
- Rbxl::WriteOnlyCell
- Defined in:
- lib/rbxl/write_only_cell.rb
Overview
Wraps a write-side cell value so that a style id can be associated with it without widening every call site to a Hash or Array.
Instances are passed transparently to Rbxl::WriteOnlyWorksheet#append (or <<) in place of a plain value:
cell = Rbxl::WriteOnlyCell.new(42, style_id: 1)
sheet << ["id", cell]
The value is serialized using the same type rules as a bare value; the style_id, when present, is emitted as the cell’s s attribute.
Instance Attribute Summary collapse
-
#style_id ⇒ Integer?
readonly
Style index into the workbook’s
cellXfstable. -
#value ⇒ Object
readonly
Underlying Ruby value (String, Numeric, Boolean, Date/DateTime/Time, or
nil).
Instance Method Summary collapse
-
#initialize(value, style_id: nil) ⇒ WriteOnlyCell
constructor
A new instance of WriteOnlyCell.
Constructor Details
#initialize(value, style_id: nil) ⇒ WriteOnlyCell
Returns a new instance of WriteOnlyCell.
23 24 25 26 |
# File 'lib/rbxl/write_only_cell.rb', line 23 def initialize(value, style_id: nil) @value = value @style_id = style_id end |
Instance Attribute Details
#style_id ⇒ Integer? (readonly)
Returns style index into the workbook’s cellXfs table.
19 20 21 |
# File 'lib/rbxl/write_only_cell.rb', line 19 def style_id @style_id end |
#value ⇒ Object (readonly)
Returns underlying Ruby value (String, Numeric, Boolean, Date/DateTime/Time, or nil).
16 17 18 |
# File 'lib/rbxl/write_only_cell.rb', line 16 def value @value end |