Sha256: 6caa60d5888e9fc3f26233f59c7610cbe3724b1334d42b7eaba96cce97abd282

Contents?: true

Size: 666 Bytes

Versions: 2

Compression:

Stored size: 666 Bytes

Contents

#!/usr/bin/env ruby

require "bundler/setup"
require "spreadshit"
require "spreadshit/window"

sheet = Spreadshit.new
[
  "Sum",
  10,
  20,
  30,
  "",
  "=A2 + A3 + A4",
  "=SUM(A2; A3; A4)",
  "=SUM(A2:A4)"
].each_with_index do |cel, index|
  sheet["A#{index + 1}"] = cel
end

# Fibonacci
sheet[:B1] = "Fibonacci"
sheet[:B2] = 0
sheet[:B3] = 1
4.upto(30).each do |n|
  sheet["B#{n}"] = "=B#{n - 1} + B#{n - 2}"
end

window = Spreadshit::Window.new do |delegate|
  delegate.cell_updated { |address, value| sheet[address] = value }
  delegate.cell_value { |address| sheet[address] }
  delegate.cell_content { |address| sheet.cell_at(address).raw }
end
window.start

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spreadshit-0.1.1 bin/demo
spreadshit-0.1.0 bin/demo