Sha256: a3844fabf1ccae4aef56197d73f863bfbf5d0236651904de4ae7f105b4c94fcb

Contents?: true

Size: 884 Bytes

Versions: 3

Compression:

Stored size: 884 Bytes

Contents

module Bosh::Stemcell
  module OperatingSystem

    def self.for(operating_system_name, operating_system_version = nil)
      case operating_system_name
        when 'centos' then Centos.new(operating_system_version)
        when 'ubuntu' then Ubuntu.new(operating_system_version)
        else raise ArgumentError.new("invalid operating system: #{operating_system_name}")
      end
    end

    class Base
      attr_reader :name, :version

      def initialize(options = {})
        @name = options.fetch(:name)
        @version = options.fetch(:version)
      end

      def ==(other)
        name == other.name
      end
    end

    class Centos < Base
      def initialize(version)
        super(name: 'centos', version: version)
      end
    end

    class Ubuntu < Base
      def initialize(version)
        super(name: 'ubuntu', version: version)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bosh-stemcell-1.2902.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2891.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2889.0 lib/bosh/stemcell/operating_system.rb