Sha256: 9583be7f17bb94918185718ddcd768b7a2398386bc2d3bcdae0cc54bf935b50d
Contents?: true
Size: 1.57 KB
Versions: 3
Compression:
Stored size: 1.57 KB
Contents
require 'date' require 'osheet/format' module Osheet class Cell include Instance include WorkbookElement include WorksheetElement include StyledElement include MarkupElement 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 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 def format(type, opts={}) set_ivar(:format, Format.new(type, opts)) end def rowspan(value); set_ivar(:rowspan, value); end def colspan(value); set_ivar(:colspan, value); end def href(value); set_ivar(:href, value); end def index(value); set_ivar(:index, value); end def formula(value); set_ivar(:formula, value); end 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 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
osheet-0.10.0 | lib/osheet/cell.rb |
osheet-0.9.2 | lib/osheet/cell.rb |
osheet-0.9.1 | lib/osheet/cell.rb |