Class: Osheet::Cell
- Inherits:
-
Object
- Object
- Osheet::Cell
- Includes:
- Instance, MarkupElement, StyledElement, WorkbookElement, WorksheetElement
- Defined in:
- lib/osheet/cell.rb
Instance Method Summary collapse
- #attributes ⇒ Object
- #colspan(value) ⇒ Object
- #data(value) ⇒ Object
- #format(type, opts = {}) ⇒ Object
- #formula(value) ⇒ Object
- #href(value) ⇒ Object
- #index(value) ⇒ Object
-
#initialize(workbook = nil, worksheet = nil, *args, &block) ⇒ Cell
constructor
A new instance of Cell.
- #rowspan(value) ⇒ Object
Methods included from MarkupElement
Methods included from StyledElement
Methods included from WorksheetElement
Methods included from WorkbookElement
Constructor Details
#initialize(workbook = nil, worksheet = nil, *args, &block) ⇒ Cell
Returns a new instance of Cell.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/osheet/cell.rb', line 12 def initialize(workbook=nil, worksheet=nil, *args, &block) set_ivar(:workbook, workbook) set_ivar(:worksheet, worksheet) set_ivar(:data, nil) set_ivar(:format, Format.new(:general)) set_ivar(:rowspan, 1) set_ivar(:colspan, 1) set_ivar(:href, nil) set_ivar(:index, nil) set_ivar(:formula, nil) if block_given? set_binding_ivars(block.binding) instance_exec(*args, &block) end end |
Instance Method Details
#attributes ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/osheet/cell.rb', line 49 def attributes { :style_class => get_ivar(:style_class), :data => get_ivar(:data), :format => get_ivar(:format), :colspan => get_ivar(:colspan), :rowspan => get_ivar(:rowspan), :href => get_ivar(:href), :index => get_ivar(:index), :formula => get_ivar(:formula) } end |
#colspan(value) ⇒ Object
44 |
# File 'lib/osheet/cell.rb', line 44 def colspan(value); set_ivar(:colspan, value); end |
#data(value) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/osheet/cell.rb', line 28 def data(value) set_ivar(:data, case value when ::String, ::Numeric, ::Date, ::Time, ::DateTime value when ::Symbol value.to_s else value.inspect.to_s end) end |
#format(type, opts = {}) ⇒ Object
39 40 41 |
# File 'lib/osheet/cell.rb', line 39 def format(type, opts={}) set_ivar(:format, Format.new(type, opts)) end |
#formula(value) ⇒ Object
47 |
# File 'lib/osheet/cell.rb', line 47 def formula(value); set_ivar(:formula, value); end |
#href(value) ⇒ Object
45 |
# File 'lib/osheet/cell.rb', line 45 def href(value); set_ivar(:href, value); end |
#index(value) ⇒ Object
46 |
# File 'lib/osheet/cell.rb', line 46 def index(value); set_ivar(:index, value); end |
#rowspan(value) ⇒ Object
43 |
# File 'lib/osheet/cell.rb', line 43 def rowspan(value); set_ivar(:rowspan, value); end |