Sha256: a883d5cdcc250d1e29db8b2120d78f275dc6679d79b8d93ae6fe0fdf40e96a3f

Contents?: true

Size: 788 Bytes

Versions: 1

Compression:

Stored size: 788 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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maid-0.4.0.beta.1 lib/maid/user_agent.rb