Sha256: 870b727fa20c94038513460da05f34ec9eb2a3fe062ce0b79b00f85f2e662ecd

Contents?: true

Size: 801 Bytes

Versions: 1

Compression:

Stored size: 801 Bytes

Contents

# frozen_string_literal: true

require_relative '../helper/json_converter'

# App Size Model
# @example 'App size: 6.6 MB compressed, 12.9 MB uncompressed'
class AppSizeModel < JSONConverter
  attr_reader :compressed, :uncompressed

  PARSING_KEYS = {
    compressed: 'compressed',
    uncompressed: 'uncompressed'
  }.freeze

  def initialize(compressed: SizeModel.placeholder, uncompressed: SizeModel.placeholder)
    super()
    @compressed = compressed
    @uncompressed = uncompressed
  end
end

# Size Model
class SizeModel < JSONConverter
  attr_reader :raw_value, :value, :unit

  def initialize(raw_value, value, unit)
    super()
    @raw_value = raw_value
    @value = value
    @unit = unit
  end

  def self.placeholder
    SizeModel.new('Unknown', 0, MemorySize::UNIT[:bytes])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danger-app_size_report-1.0.0 lib/converter/models/app_size_model.rb