class Spread2RDF::Coord

Public Class Methods

[](*args)
Alias for: new
increment_column(column, count=1) click to toggle source
# File lib/spread2rdf/coord.rb, line 43
def increment_column(column, count=1)
  Roo::Base.number_to_letter(Roo::Base.letter_to_number(column) + count)
end
new(*args) click to toggle source
Calls superclass method
# File lib/spread2rdf/coord.rb, line 3
def initialize(*args)
  case args.length
    when 2 then super
    when 1
      case args = args.first
        when Hash
          super(args[:column], args[:row])
        when Symbol, String
          coord = args.to_s
          raise "Invalid cell coordinates #{coord}" unless coord =~ /([A-Za-z]+)(\d+)/
          super(Regexp.last_match[1], Regexp.last_match[2].to_i)
        else raise ArgumentError, "can't handle argument #{args}"
      end
    else raise ArgumentError, "too many arguments: #{args}"
  end
end
Also aliased as: []

Public Instance Methods

column_as_index() click to toggle source
# File lib/spread2rdf/coord.rb, line 24
def column_as_index
  column_as_number - 1
end
column_as_number() click to toggle source
# File lib/spread2rdf/coord.rb, line 20
def column_as_number
  Roo::Base.letter_to_number(column)
end
increment_column(count = 1) click to toggle source
# File lib/spread2rdf/coord.rb, line 28
def increment_column(count = 1)
  self.class.increment_column(self.column, count)
end
to_s() click to toggle source
# File lib/spread2rdf/coord.rb, line 32
def to_s
  "#{column}#{row}"
end
to_sym() click to toggle source
# File lib/spread2rdf/coord.rb, line 36
def to_sym
  to_s.to_sym
end