Class: Osheet::Column

Inherits:
Object
  • Object
show all
Includes:
Instance, MarkupElement, MetaElement, StyledElement, WorkbookElement, WorksheetElement
Defined in:
lib/osheet/column.rb

Instance Method Summary collapse

Methods included from MarkupElement

#add

Methods included from MetaElement

#meta

Methods included from StyledElement

#style_class

Methods included from WorksheetElement

#worksheet

Methods included from WorkbookElement

#workbook

Constructor Details

#initialize(workbook = nil, worksheet = nil, *args, &block) ⇒ Column

Returns a new instance of Column.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/osheet/column.rb', line 10

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

Instance Method Details

#attributesObject



30
31
32
33
34
35
36
37
# File 'lib/osheet/column.rb', line 30

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

#autofit(value) ⇒ Object



25
# File 'lib/osheet/column.rb', line 25

def autofit(value); set_ivar(:autofit, !!value); end

#autofit?Boolean

Returns:

  • (Boolean)


26
# File 'lib/osheet/column.rb', line 26

def autofit?; get_ivar(:autofit); end

#hidden(value) ⇒ Object



27
# File 'lib/osheet/column.rb', line 27

def hidden(value); set_ivar(:hidden, !!value); end

#hidden?Boolean

Returns:

  • (Boolean)


28
# File 'lib/osheet/column.rb', line 28

def hidden?; get_ivar(:hidden); end

#width(value = nil) ⇒ Object



22
23
24
# File 'lib/osheet/column.rb', line 22

def width(value=nil)
  !value.nil? ? set_ivar(:width, value) : get_ivar(:width)
end