Sha256: dd9b1fcc4b99969da727efa7db3a99314f203bfd3e86e4028f0f9e2a363d03d7

Contents?: true

Size: 752 Bytes

Versions: 3

Compression:

Stored size: 752 Bytes

Contents

# frozen_string_literal: true

module Apkstats::Entity
  class ApkInfo
    KEYS = %i(
      file_size
      download_size
      required_features
      non_required_features
      permissions
      min_sdk
      target_sdk
    ).freeze

    # Integer
    attr_accessor :file_size, :download_size

    # String
    attr_accessor :min_sdk, :target_sdk

    # Array<String>
    attr_accessor :required_features, :non_required_features, :permissions

    def initialize(command, apk_filepath)
      KEYS.each do |key|
        self.send("#{key}=", command.send(key, apk_filepath))
      end
    end

    def [](key)
      send(key)
    end

    def to_h
      KEYS.each_with_object({}) do |key, acc|
        acc[key] = self[key]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danger-apkstats-0.1.2 lib/apkstats/entity/apk_info.rb
danger-apkstats-0.1.1.pre.1 lib/apkstats/entity/apk_info.rb
danger-apkstats-0.1.0 lib/apkstats/entity/apk_info.rb