Sha256: 6c541d6b5b574649483b427bae92cae26ddab9e5880df90375d661e6a5d72de2

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 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.
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

2 entries across 2 versions & 1 rubygems

Version Path
maid-0.2.0.beta.1 lib/maid/user_agent.rb
maid-0.2.0.alpha.1 lib/maid/user_agent.rb