lib/rspreadsheet/row.rb in rspreadsheet-0.1.0 vs lib/rspreadsheet/row.rb in rspreadsheet-0.1.1
- old
+ new
@@ -1,14 +1,16 @@
require('rspreadsheet/cell')
-include Forwardable
+require('forwardable')
+
# Currently this is only syntax sugar for cells and contains no functionality
module Rspreadsheet
class RowArray
- def initialize(aworksheet_node)
+ def initialize(aworksheet,aworksheet_node)
+ @worksheet = aworksheet
@worksheet_node = aworksheet_node
# initialize @rowgroups from @worksheet_node
@rowgroups = []
unless @worksheet_node.nil?
@@ -104,11 +106,11 @@
# do the replacement in array
@rowgroups[index..index]=replaceby
result
end
-
+ def worksheet; @worksheet end
private
def get_row_group_index(rowi)
@rowgroups.find_index{ |rowgroup| rowgroup.range.cover?(rowi) }
end
end
@@ -117,9 +119,11 @@
@readonly = :unknown
# ? @rowindex
def self.empty_row_node
LibXML::XML::Node.new('table-row',nil, Tools.get_namespace('table'))
end
+ def worksheet; @parent_array.worksheet end
+ def parent_array; @parent_array end # for debug only
end
class RowWithXMLNode < Row
attr_accessor :xmlnode
def style_name=(value); Tools.set_ns_attribute(@xmlnode,'table','style-name',value) end
\ No newline at end of file