lib/osheet/worksheet.rb in osheet-0.1.0 vs lib/osheet/worksheet.rb in osheet-0.2.0
- old
+ new
@@ -1,29 +1,27 @@
-require 'osheet/base'
require 'osheet/column'
require 'osheet/row'
-# === Usage
-#
-# require 'osheet'
-#
-# Osheet::Workbook.configure do |book|
-# book.worksheet ...
-# book.worksheet ...
-# end
-
module Osheet
- class Worksheet < Osheet::Base
-
- attr_reader :name
+ class Worksheet
+ include Associations
+ include WorkbookElement
- needs :workbook
- has :columns => "Column"
- has :rows => "Row"
+ hm :columns
+ hm :rows
- def initialize(name=nil, args={})
- @name = name
- super(args)
+ def initialize(workbook=nil, *args, &block)
+ @workbook = workbook
+ @name = nil
+ instance_exec(*args, &block) if block_given?
end
-
+
+ def name(value=nil)
+ !value.nil? ? @name = value : @name
+ end
+
+ def attributes
+ { :name => @name }
+ end
+
end
end