Sha256: 6a0b54f17d1064b9c06df99b9d16eb968e5e88bbf1141b8804a7c2d6dfc343b8

Contents?: true

Size: 670 Bytes

Versions: 10

Compression:

Stored size: 670 Bytes

Contents

# frozen_string_literal: true

module CodeKindly
  module Utils
    class OS
      class << self
        def notify(message)
          return if terminal_notifier.nil?
          Command.run [
            terminal_notifier,
            "-message \"#{message}\"",
            '-sound Submarine'
          ].join(' ')
        end

        def which(program)
          Command.run("which #{program}").result
        end

        private

        def terminal_notifier
          unless instance_variable_defined? :@terminal_notifier
            @terminal_notifer = which('terminal-notifier')
          end
          @terminal_notifier
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
codekindly-utils-0.1.0 lib/code_kindly/utils/os.rb
codekindly-utils-0.0.14 lib/code_kindly/utils/os.rb
codekindly-utils-0.0.13 lib/code_kindly/utils/os.rb
codekindly-utils-0.0.12 lib/code_kindly/utils/os.rb
codekindly-utils-0.0.11 lib/code_kindly/utils/os.rb
codekindly-utils-0.0.10 lib/code_kindly/utils/os.rb
codekindly-utils-0.0.9 lib/code_kindly/utils/os.rb
codekindly-utils-0.0.8 lib/code_kindly/utils/os.rb
codekindly-utils-0.0.7 lib/code_kindly/utils/os.rb
codekindly-utils-0.0.6 lib/code_kindly/utils/os.rb