Sha256: 0f27557fc83a2e5f84c862b05cc8c3f22ad376ee643bbc0dab587279b6430bd8

Contents?: true

Size: 684 Bytes

Versions: 3

Compression:

Stored size: 684 Bytes

Contents

require 'naturally'
require 'simctl/object'

module SimCtl
  class Runtime < Object
    attr_reader :availability, :buildversion, :identifier, :name, :type, :version

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

    def ==(other)
      return false if other.nil?
      return false unless other.kind_of? 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: %r|#{type}|i), :version).last
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simctl-1.6.2 lib/simctl/runtime.rb
simctl-1.6.1 lib/simctl/runtime.rb
simctl-1.6.0 lib/simctl/runtime.rb