module Osheet::WorkbookApi

Public Instance Methods

border(*args) click to toggle source
# File lib/osheet/workbook_api.rb, line 150
def border(*args)
  element_stack.current.border(*args)
end
cell(*args, &block) click to toggle source

used on: row

# File lib/osheet/workbook_api.rb, line 134
def cell(*args, &block)
  if args.empty? && block.nil?
    cells.last
  else
    TemplatedElement.new(self, :cell, *args, &block).add
  end
end
cells() click to toggle source
# File lib/osheet/workbook_api.rb, line 27
def cells
  rows.last.cells
end
column(*args, &block) click to toggle source

used on: worksheet

# File lib/osheet/workbook_api.rb, line 120
def column(*args, &block)
  TemplatedElement.new(self, :column, *args, &block).add
end
columns() click to toggle source
# File lib/osheet/workbook_api.rb, line 19
def columns
  worksheets.last.columns
end
format(*args) click to toggle source

used by: cell

# File lib/osheet/workbook_api.rb, line 175
def format(*args)
  current_format = element_stack.current.format(*args)   # for self referencing
  if !args.empty? && self.writer                         # for writing
    self.writer.style(element_stack.current.style_class, current_format)
  end
  current_format
end
meta(*args) click to toggle source

element attribute API

# File lib/osheet/workbook_api.rb, line 156
def meta(*args)
  element_stack.current.meta(*args)
end
partial(*args, &build) click to toggle source
# File lib/osheet/workbook_api.rb, line 39
def partial(*args, &build)
  Osheet::Partial.new(*args, &build).tap do |partial|
    element_stack.current.partial(partial)
  end
end
row(*args, &block) click to toggle source

used on: worksheet

# File lib/osheet/workbook_api.rb, line 125
def row(*args, &block)
  if args.empty? && block.nil?
    rows.last
  else
    TemplatedElement.new(self, :row, *args, &block).add
  end
end
rows() click to toggle source
# File lib/osheet/workbook_api.rb, line 23
def rows
  worksheets.last.rows
end
style(*args, &build) click to toggle source
# File lib/osheet/workbook_api.rb, line 60
def style(*args, &build)
  StyleBuild.new(self, *args, &build).add do |build|
    build.call
  end
end
style_class(value=nil) click to toggle source

used by: column, row, cell

# File lib/osheet/workbook_api.rb, line 166
def style_class(value=nil)
  current_class  = element_stack.current.style_class(value)  # for self referencing
  if value && self.writer                                    # for writing
    self.writer.style(current_class, element_stack.current.format)
  end
  current_class
end
template(*args, &build) click to toggle source

markup handling API

# File lib/osheet/workbook_api.rb, line 33
def template(*args, &build)
  Osheet::Template.new(*args, &build).tap do |template|
    element_stack.current.template(template)
  end
end
title(*args) click to toggle source

used by: workbook_element

# File lib/osheet/workbook_api.rb, line 184
def title(*args)
  element_stack.current.title(*args)
end
worksheet(*args, &block) click to toggle source

used on: workbook

# File lib/osheet/workbook_api.rb, line 111
def worksheet(*args, &block)
  if args.empty? && block.nil?
    worksheets.last
  else
    TemplatedElement.new(self, :worksheet, *args, &block).add
  end
end
worksheets() click to toggle source
# File lib/osheet/workbook_api.rb, line 15
def worksheets
  workbook.worksheets
end