Sha256: eafb6202b663fb9f99ee95db6022538062e828ba702db4a80c266268872fbbbd

Contents?: true

Size: 909 Bytes

Versions: 3

Compression:

Stored size: 909 Bytes

Contents

require 'naturally'
require 'simctl/object'

module SimCtl
  class Runtime < Object
    extend Gem::Deprecate

    attr_reader :buildversion, :identifier, :is_available, :name, :type, :version

    def initialize(args)
      args['is_available'] = args.delete('isAvailable')
      super
    end

    def availability
      is_available
    end
    deprecate :availability, :is_available, 2020, 8

    def type
      @type ||= name.split("\s").first.downcase.to_sym
    end

    def ==(other)
      return false if other.nil?
      return false unless other.is_a? Runtime
      other.identifier == identifier
    end

    # Returns the latest available runtime
    #
    # @param name [String] type (ios, watchos, tvos)
    # @return [SimCtl::Runtime] the latest available runtime
    def self.latest(type)
      Naturally.sort_by(SimCtl.list_runtimes.where(name: /#{type}/i), :version).last
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simctl-1.6.8 lib/simctl/runtime.rb
simctl-1.6.7 lib/simctl/runtime.rb
simctl-1.6.6 lib/simctl/runtime.rb