Sha256: f98ea47fde6bbea58f01cadbee690d3f79e8f19deec812a934a0c6b9ede53ec3

Contents?: true

Size: 406 Bytes

Versions: 1

Compression:

Stored size: 406 Bytes

Contents

module GalaxyConverter
  module Stretcher
    extend self

    LONG_TO_SHORT = {
      "DCCCC" => "CM", # 900
      "CCCC"  => "CD", # 400
      "LXXXX" => "XC", # 90
      "XXXX"  => "XL", # 40
      "VIIII" => "IX", # 9
      "IIII"  => "IV"  # 4
    }

    def call(value)
      LONG_TO_SHORT.reduce(value) do |to_convert, (long, short)|
        to_convert.gsub(short, long)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
galaxy_converter-3.0.1 lib/galaxy_converter/stretcher.rb