class ReadXls::Type::ExtendedFormat

Constants

FORMAT_MATCHERS

Attributes

format_string[RW]

Public Class Methods

new(options) click to toggle source
# File lib/read_xls/type/extended_format.rb, line 10
def initialize(options)
  self.format_string = options.fetch(:format_string)
end

Public Instance Methods

format_type() click to toggle source
# File lib/read_xls/type/extended_format.rb, line 14
def format_type
  matched_types = FORMAT_MATCHERS.select { |matcher, _| format_string =~ matcher }

  if matched_types.length > 1
    raise "got more than one match, expected only one matched format type"
  end

  matched_types.values.first
end