Sha256: 4adbf6011767c07234ef47ef31fad43c6865ab586eb350c69e9ceb67f73e9996

Contents?: true

Size: 674 Bytes

Versions: 3

Compression:

Stored size: 674 Bytes

Contents

module Storey
  class Suffixifier

    def self.suffixify(*args)
      self.new(*args).suffixify
    end

    def initialize(schema_name)
      @schema_name = schema_name
    end

    def suffixify
      schema_names.map do |schema_name|
        if schema_name =~ /\w+#{suffix}/ || native_schema?(schema_name)
          schema_name
        else
          "#{schema_name}#{suffix}"
        end
      end.join(', ')
    end

    private

    def schema_names
      @schema_names ||= @schema_name.split(',').map(&:strip)
    end

    def suffix
      Storey.suffix
    end

    def native_schema?(schema_name)
      NativeSchemaMatcher.matches?(schema_name)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
storey-2.0.2 lib/storey/suffixifier.rb
storey-2.0.1 lib/storey/suffixifier.rb
storey-2.0.0 lib/storey/suffixifier.rb