lib/osheet/row.rb in osheet-0.1.0 vs lib/osheet/row.rb in osheet-0.2.0

- old
+ new

@@ -1,14 +1,39 @@ -require 'osheet/base' require 'osheet/cell' module Osheet - class Row < Osheet::Base - - has :cells => "Cell" + class Row + include Associations + include WorkbookElement + include WorksheetElement + include StyledElement - def initialize(args={}) - super(args) + hm :cells + + def initialize(workbook=nil, worksheet=nil, *args, &block) + @workbook = workbook + @worksheet = worksheet + @height = nil + @autofit = false + @hidden = false + instance_exec(*args, &block) if block_given? end - + + def height(value=nil) + !value.nil? ? @height = value : @height + end + def autofit(value); @autofit = !!value; end + def autofit?; @autofit; end + def hidden(value); @hidden = !!value; end + def hidden?; @hidden; end + + def attributes + { + :style_class => @style_class, + :height => @height, + :autofit => @autofit, + :hidden => @hidden + } + end + end end