Sha256: 466f95040cf8d3e0b539fca5f92cf4d0924fa75e8cf80dd67d91d77c42a9680b

Contents?: true

Size: 348 Bytes

Versions: 6

Compression:

Stored size: 348 Bytes

Contents

# frozen_string_literal: true
module Saxlsx
  class BooleanParser

    def self.parse(string)
      return true if string == true || string =~ (/(true|t|yes|y|1)$/i)
      return false if string == false || string.nil? || string =~ (/(false|f|no|n|0)$/i)
      raise ArgumentError.new("Invalid value for Boolean: \"#{string}\"")
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
saxlsx-1.11.0 lib/saxlsx/boolean_parser.rb
saxlsx-1.10.0 lib/saxlsx/boolean_parser.rb
saxlsx-1.9.0 lib/saxlsx/boolean_parser.rb
saxlsx-1.8.0 lib/saxlsx/boolean_parser.rb
saxlsx-1.7.1 lib/saxlsx/boolean_parser.rb
saxlsx-1.7.0 lib/saxlsx/boolean_parser.rb