Sha256: 279cb09b1565c0cca0f81db60d8c2c8c4f0e4b8daa8e7984a6df833fa7f49f0b

Contents?: true

Size: 842 Bytes

Versions: 13

Compression:

Stored size: 842 Bytes

Contents

require 'ohai'

# Version information for the host system, kind of like a browser's user agent string.
#
# This could potentially be a part of `Platform` or `VERSION` but both of those are used when building the gemspec,
# which can't depend on other gems.  FIXME: That's no longer accurate, so this could be `Platform.user_agent` instead.
module Maid::UserAgent
  class << self
    # This used to be called `#to_s`, but that made things difficult when testing.
    def value
      ohai = Ohai::System.new
      ohai.all_plugins
      ohai_rb = ohai['languages']['ruby']

      maid     = "Maid/#{ ::Maid.const_get(:VERSION) }"
      platform = "#{ ohai['platform'] }/#{ ohai['platform_version'] }"
      ruby     = "Ruby/#{ ohai_rb['version'] } #{ ohai_rb['platform'] }"
      
      "#{ maid } (#{ platform }; #{ ruby })"
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
maid-0.4.0.alpha.2 lib/maid/user_agent.rb
maid-0.4.0.alpha.1 lib/maid/user_agent.rb
maid-0.3.0 lib/maid/user_agent.rb
maid-0.3.0.beta.1 lib/maid/user_agent.rb
maid-0.2.3.alpha.1 lib/maid/user_agent.rb
maid-0.2.2 lib/maid/user_agent.rb
maid-0.2.2.beta.1 lib/maid/user_agent.rb
maid-0.2.1 lib/maid/user_agent.rb
maid-0.2.0 lib/maid/user_agent.rb
maid-0.2.0.rc.2 lib/maid/user_agent.rb
maid-0.2.0.rc.1 lib/maid/user_agent.rb
maid-0.2.0.beta.3 lib/maid/user_agent.rb
maid-0.2.0.beta.2 lib/maid/user_agent.rb