Sha256: 7800ef8ff06977276f451ddb65ee849650362bc1efcd4d0aab89faa1c15e462f
Contents?: true
Size: 1.23 KB
Versions: 4
Compression:
Stored size: 1.23 KB
Contents
require 'date' require 'osheet/format' require 'osheet/meta_element' require 'osheet/styled_element' module Osheet class Cell include MetaElement include StyledElement def initialize(data_value=nil) @data = cast_data_value(data_value) @format = Format.new(:general) @rowspan = 1 @colspan = 1 @index = nil @href = nil @formula = nil end def data(value=nil) value.nil? ? @data : @data = cast_data_value(value) end def format(value=nil, opts={}) value.nil? ? @format : @format = Format.new(value, opts) end def rowspan(value=nil) value.nil? ? @rowspan : @rowspan = value end def colspan(value=nil) value.nil? ? @colspan : @colspan = value end def index(value=nil) value.nil? ? @index : @index = value end def href(value=nil) value.nil? ? @href : @href = value end def formula(value=nil) value.nil? ? @formula : @formula = value end private def cast_data_value(value) case value when ::String, ::Numeric, ::Date, ::Time, ::DateTime, ::NilClass value when ::Symbol value.to_s else value.inspect.to_s end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
osheet-1.0.0.rc.4 | lib/osheet/cell.rb |
osheet-1.0.0.rc.3 | lib/osheet/cell.rb |
osheet-1.0.0.rc.2 | lib/osheet/cell.rb |
osheet-1.0.0.rc.1 | lib/osheet/cell.rb |