Class: ReadXls::Type::ExtendedFormat
- Inherits:
-
Object
- Object
- ReadXls::Type::ExtendedFormat
- Defined in:
- lib/read_xls/type/extended_format.rb
Constant Summary collapse
- FORMAT_MATCHERS =
{ /[YMDymd]/ => :date }
Instance Attribute Summary collapse
-
#format_string ⇒ Object
Returns the value of attribute format_string.
Instance Method Summary collapse
- #format_type ⇒ Object
-
#initialize(options) ⇒ ExtendedFormat
constructor
A new instance of ExtendedFormat.
Constructor Details
#initialize(options) ⇒ ExtendedFormat
Returns a new instance of ExtendedFormat.
10 11 12 |
# File 'lib/read_xls/type/extended_format.rb', line 10 def initialize() self.format_string = .fetch(:format_string) end |
Instance Attribute Details
#format_string ⇒ Object
Returns the value of attribute format_string.
4 5 6 |
# File 'lib/read_xls/type/extended_format.rb', line 4 def format_string @format_string end |
Instance Method Details
#format_type ⇒ Object
14 15 16 17 18 19 20 21 22 |
# 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 |