Sha256: bd73ce2718836ae71055c8f09bb2c074e90d4b9b605dfb4a8fc2a7d1f019f31b

Contents?: true

Size: 356 Bytes

Versions: 31

Compression:

Stored size: 356 Bytes

Contents

module Lookbook
  class PriorityPrefixParser < Service
    PRIORITY_PREFIX_REGEX = /^(\d+?)[-_]/

    attr_reader :input

    def initialize(input)
      @input = String(input)
    end

    def call
      matches = input.match(PRIORITY_PREFIX_REGEX)
      matches ? [matches[1].to_i, input.gsub(PRIORITY_PREFIX_REGEX, "")] : [nil, input]
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
lookbook-2.3.4 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.3.3 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.3.2 lib/lookbook/services/priority_prefix_parser.rb
lookbook-3.0.0.alpha.2 lib/lookbook/services/priority_prefix_parser.rb
lookbook-3.0.0.alpha.1 lib/lookbook/services/priority_prefix_parser.rb
lookbook-3.0.0.alpha.0 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.3.0 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.2.2 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.2.1 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.2.0 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.1.1 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.1.0 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.5 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.4 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.3 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.2 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.1 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0.rc.3 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0.rc.2 lib/lookbook/services/priority_prefix_parser.rb