lib/algolia/user_agent.rb in algolia-3.5.1 vs lib/algolia/user_agent.rb in algolia-3.5.2

- old
+ new

@@ -6,10 +6,16 @@ @value = "Algolia for Ruby (#{VERSION}); Ruby (#{RUBY_VERSION})" end # Adds a segment to the UserAgent # - def add(segment, version) - @value += format("; %<segment>s (%<version>s)", segment: segment, version: version) + def add(segment, version = nil) + if version.nil? + @value += format("; %<segment>s", segment: segment) + else + @value += format("; %<segment>s (%<version>s)", segment: segment, version: version) + end + + self end end end