Sha256: f36ce6545577c6f7add25389b73089394e34535e2c81082b3caab736fa0f26c5

Contents?: true

Size: 458 Bytes

Versions: 4

Compression:

Stored size: 458 Bytes

Contents

# frozen_string_literal: true

module Dolos
  module CommonParsers
    def ws
      regex(/\s/)
    end

    def eol
      regex(/\n|\r\n|\r/)
    end

    # Capture as String and convert to integer
    def digit
      regex(/\d/).capture!.map { |capt| capt.map(&:to_i) }
    end

    # Capture as string
    def digits
      regex(/\d+/)
    end

    def alpha_num
      regex(/[a-zA-Z0-9]/)
    end

    def alpha
      regex(/[a-zA-Z]/)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dolos-0.1.3 lib/dolos_common_parsers/common_parsers.rb
dolos-0.1.2 lib/dolos_common_parsers/common_parsers.rb
dolos-0.1.1 lib/dolos_common_parsers/common_parsers.rb
dolos-0.1.0 lib/dolos_common_parsers/common_parsers.rb