Sha256: 5cdfb69f9c05b0f525fa4f19b9db5fec56167aa4735429dd7f958b88ef228d1d

Contents?: true

Size: 413 Bytes

Versions: 5

Compression:

Stored size: 413 Bytes

Contents

# frozen_string_literal: true

module WSDirector
  module Utils # :nodoc:
    MULTIPLIER_FORMAT = /^[-+*\/\\\d ]+$/

    attr_reader :scale

    def parse_multiplier(str)
      prepared = str.to_s.gsub(":scale", scale.to_s)
      raise WSDirector::Error, "Unknown multiplier format: #{str}" unless
        MULTIPLIER_FORMAT.match?(prepared)

      eval(prepared) # rubocop:disable Security/Eval
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wsdirector-core-1.1.0 lib/wsdirector/utils.rb
wsdirector-core-1.0.3 lib/wsdirector/utils.rb
wsdirector-core-1.0.2 lib/wsdirector/utils.rb
wsdirector-core-1.0.1 lib/wsdirector/utils.rb
wsdirector-core-1.0.0 lib/wsdirector/utils.rb