Module: HumanTone::UserAgent

Defined in:
lib/humantone/user_agent.rb

Class Method Summary collapse

Class Method Details

.build(suffix: nil) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/humantone/user_agent.rb', line 15

def build(suffix: nil)
  base = "humantone-ruby/#{sdk_version} (ruby/#{RUBY_VERSION})"
  normalized = (suffix || '').strip
  return base if normalized.empty?

  "#{base} #{normalized}"
end

.sdk_versionObject



8
9
10
11
12
13
# File 'lib/humantone/user_agent.rb', line 8

def sdk_version
  spec = Gem::Specification.find_by_name('humantone')
  spec ? spec.version.to_s : VERSION
rescue Gem::LoadError
  VERSION
end