Sha256: 53799d0d8af800fc4feb26315fdea82cffa55a9cea94c784a44a2faf56299c38

Contents?: true

Size: 692 Bytes

Versions: 34

Compression:

Stored size: 692 Bytes

Contents

module Bosh::Stemcell
  module OperatingSystem
    def self.for(operating_system_name)
      case operating_system_name
        when 'centos' then Centos.new
        when 'ubuntu' then Ubuntu.new
        else raise ArgumentError.new("invalid operating system: #{operating_system_name}")
      end
    end

    class Base
      attr_reader :name

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

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

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

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

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
bosh-stemcell-1.2131.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2129.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2124.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2121.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2089.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2086.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2068.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2063.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.2005.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.1975.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.1868.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.1858.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.1840.0 lib/bosh/stemcell/operating_system.rb
bosh-stemcell-1.1836.0 lib/bosh/stemcell/operating_system.rb