Sha256: e5b3f0f0c9d4ce7ab44d1c13afcac0f2281b46e688280f3393087760ca3cf819

Contents?: true

Size: 701 Bytes

Versions: 3

Compression:

Stored size: 701 Bytes

Contents

module Reality
  module Describers
    class Wikidata
      # FIXME: All of it is as ad-hoc as possible.
      # Should be reconsidered from the standpoints:
      # * permanent cache of ALL wikidata units and their corresponded "parsings"; probably with using
      #   ad-hoc scripts + curated editing; but Wikidata also provides helpful data sometimes, like
      #   "SI equivalent" and stuff
      # * moving the functionality to Reality::Measure?
      module Units
        module_function

        SYNONYMS = {
          metre: 'm',
          meter: 'm'
        }.transform_keys(&:to_s).freeze

        def parse(str)
          SYNONYMS.fetch(str, str)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reality-0.1.0.alpha3 lib/reality/describers/wikidata/units.rb
reality-0.1.0.alpha2 lib/reality/describers/wikidata/units.rb
reality-0.1.0.alpha lib/reality/describers/wikidata/units.rb