Sha256: 9e2a0f88d5082efe3afb73192db78c0e6f98e0f1afd4f9243ca5b5d76fafb24c

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

require 'osheet/cell'

module Osheet
  class Row
    include Instance
    include Associations
    include WorkbookElement
    include WorksheetElement
    include StyledElement
    include MetaElement
    include MarkupElement

    hm :cells

    def initialize(workbook=nil, worksheet=nil, *args, &block)
      set_ivar(:workbook, workbook)
      set_ivar(:worksheet, worksheet)
      set_ivar(:height, nil)
      set_ivar(:autofit, false)
      set_ivar(:hidden, false)
      if block_given?
        set_binding_ivars(block.binding)
        instance_exec(*args, &block)
      end
    end

    def height(value=nil)
      !value.nil? ? set_ivar(:height, value) : get_ivar(:height)
    end
    def autofit(value); set_ivar(:autofit, !!value); end
    def autofit?; get_ivar(:autofit); end
    def hidden(value); set_ivar(:hidden, !!value); end
    def hidden?; get_ivar(:hidden); end

    def attributes
      {
        :style_class => get_ivar(:style_class),
        :height => get_ivar(:height),
        :autofit => get_ivar(:autofit),
        :hidden => get_ivar(:hidden)
      }
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
osheet-0.10.0 lib/osheet/row.rb
osheet-0.9.2 lib/osheet/row.rb
osheet-0.9.1 lib/osheet/row.rb
osheet-0.9.0 lib/osheet/row.rb
osheet-0.8.0 lib/osheet/row.rb
osheet-0.7.0 lib/osheet/row.rb
osheet-0.6.0 lib/osheet/row.rb