Module: Indexer::Revision

Extended by:
Revision
Included in:
Revision
Defined in:
lib/indexer/revision.rb

Overview

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).

Instance Method Summary collapse

Instance Method Details

#r2013(data) ⇒ Object

Update R2013 specification to current specification.



36
37
38
# File 'lib/indexer/revision.rb', line 36

def r2013(data)
  data
end

#upconvert(data) ⇒ Object

Revise the metadata to current standard.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/indexer/revision.rb', line 16

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