Sha256: 515b1756183890ea1b8c6df67c298c4407e6d71fa3a139b21f4215a12a2fc53a

Contents?: true

Size: 970 Bytes

Versions: 4

Compression:

Stored size: 970 Bytes

Contents

module Indexer

  # Indexer's revision strategy is a "no project left behind" strategy.
  # When using the API, is a specification is loaded that is outdated,
  # it will be upconverted to the latest standard.
  #
  # If you absolutely *must* support an old revision then use an older
  # version of Indexer, or work with the metadata manually (via YAML).
  #
  module Revision
    extend self

    #
    # Revise the metadata to current standard.
    #
    def upconvert(data)
      revision = data['revision'] || data[:revision]

      revision = REVISION unless revision

      if revision != REVISION
        begin
          require "revisions/r#{revision}"
          __send__("r#{revision}", data)
        rescue LoadError
          raise ValidationError, "unknown revision #{revision}"
        end
      else
        data
      end
    end

    #
    # Update R2013 specification to current specification.
    #
    def r2013(data)
      data
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
indexer-0.3.1 lib/indexer/revision.rb
indexer-0.3.0 lib/indexer/revision.rb
indexer-0.2.0 lib/indexer/revision.rb
indexer-0.1.0 lib/indexer/revision.rb