Sha256: 074244e228a13801a4d58fd954ed81b1f3497a0fffde20ca49ad71d824ee02c7

Contents?: true

Size: 675 Bytes

Versions: 12

Compression:

Stored size: 675 Bytes

Contents

module AgileNotifier
  class OperatingSystem
    TYPE = {
      lin: 'linux',
      mac: 'osx',
      win: 'windows',
      unknown: 'UNKNOWN'
    }

    class << self
      def is_linux?
        match_os(/linux/)
      end

      def is_mac?
        match_os(/darwin/)
      end

      def is_windows?
        match_os(/mswin|mingw|cygwin|bccwin|wince|emx/)
      end

      def match_os(regex)
        !!RUBY_PLATFORM.match(regex)
      end

      def what
        return TYPE[:lin] if is_linux?
        return TYPE[:mac] if is_mac?
        return TYPE[:win] if is_windows?
        return TYPE[:unknown]
      end
    end

    private_class_method :new, :match_os
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
agile_notifier-3.1.2 lib/agile_notifier/operating_system.rb
agile_notifier-3.0.2 lib/agile_notifier/operating_system.rb
agile_notifier-3.0.1 lib/agile_notifier/operating_system.rb
agile_notifier-3.0.0 lib/agile_notifier/operating_system.rb
agile_notifier-2.1.4 lib/agile_notifier/operating_system.rb
agile_notifier-2.1.3 lib/agile_notifier/operating_system.rb
agile_notifier-2.1.2 lib/agile_notifier/operating_system.rb
agile_notifier-2.1.1 lib/agile_notifier/operating_system.rb
agile_notifier-2.1 lib/agile_notifier/operating_system.rb
agile_notifier-2.0 lib/agile_notifier/operating_system.rb
agile_notifier-1.1.1 lib/agile_notifier/operating_system.rb
agile_notifier-1.1 lib/agile_notifier/operating_system.rb