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.0.0.rc.1 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0.beta.9 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0.beta.8 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0.beta.7 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0.beta.6 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0.beta.5 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0.beta.4 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0.beta.3 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0.beta.2 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0.beta.1 lib/lookbook/services/priority_prefix_parser.rb
lookbook-2.0.0.beta.0 lib/lookbook/services/priority_prefix_parser.rb