class ElasticAPM::Config::Size

@api private

Constants

MULTIPLIERS
REGEX

Attributes

bytes[RW]

Public Class Methods

new(bytes) click to toggle source
# File lib/elastic_apm/config/size.rb, line 13
def initialize(bytes)
  @bytes = bytes
end
parse(str, default_unit:) click to toggle source
# File lib/elastic_apm/config/size.rb, line 19
def self.parse(str, default_unit:)
  _, amount, unit = REGEX.match(str).to_a
  unit ||= default_unit
  bytes = MULTIPLIERS.fetch(unit.downcase, 1) * amount.to_i
  new(bytes)
end