Method: RubyXL::Reference#initialize
- Defined in:
- lib/rubyXL/objects/reference.rb
#initialize(*params) ⇒ Reference
RubyXL::Reference.new(row, col) RubyXL::Reference.new(row_from, row_to, col_from, col_to) RubyXL::Reference.new(reference_string)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rubyXL/objects/reference.rb', line 11 def initialize(*params) row_from = row_to = col_from = col_to = nil case params.size when 4 then row_from, row_to, col_from, col_to = params when 2 then row_from, col_from = params when 1 then raise ArgumentError.new("invalid value for #{self.class}: #{params[0].inspect}") unless params[0].is_a?(String) from, to = params[0].split(':') row_from, col_from = self.class.ref2ind(from) row_to, col_to = self.class.ref2ind(to) unless to.nil? end @row_range = Range.new(row_from || 0, row_to || row_from || ROW_MAX) @col_range = Range.new(col_from || 0, col_to || col_from || COL_MAX) end |