Sha256: 1a2843d436f64f2d1e49e6e3b858588051c18736d01fb302316f550e4c430fbc

Contents?: true

Size: 498 Bytes

Versions: 1

Compression:

Stored size: 498 Bytes

Contents

# encoding: UTF-8

module Unicafe
  class PriceParser

    MAUKKAASTI = '4.20'
    EDULLISESTI = '2.60'
    KEVYESTI = '2.30'

    def parse price_string
      case price_string
      when 'Maukkaasti'
        MAUKKAASTI
      when 'Edullisesti'
        EDULLISESTI
      when 'Kevyesti'
        KEVYESTI
      when /^Makeasti (.*)$/
        price_string.match(/([,0-9]+)/)[0].gsub(',','.')
      else
        raise PriceError
      end
    end

    class PriceError < Exception
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unicafe-0.0.3 lib/unicafe/price_parser.rb