Class: KcoRuby::UserAgentField

Inherits:
Object
  • Object
show all
Defined in:
lib/kco_ruby/user_agent.rb

Overview

The field class is used to describe a UserAgent field

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier, name, version, options = nil) ⇒ UserAgentField



32
33
34
35
36
37
# File 'lib/kco_ruby/user_agent.rb', line 32

def initialize(identifier, name, version, options = nil)
  @identifier = identifier
  @name = name
  @version = version
  @options = options
end

Instance Attribute Details

#identifierObject

Returns the value of attribute identifier.



29
30
31
# File 'lib/kco_ruby/user_agent.rb', line 29

def identifier
  @identifier
end

#nameObject

Returns the value of attribute name.



29
30
31
# File 'lib/kco_ruby/user_agent.rb', line 29

def name
  @name
end

#options=(value) ⇒ Object (writeonly)

Sets the attribute options



30
31
32
# File 'lib/kco_ruby/user_agent.rb', line 30

def options=(value)
  @options = value
end

#versionObject

Returns the value of attribute version.



29
30
31
# File 'lib/kco_ruby/user_agent.rb', line 29

def version
  @version
end

Instance Method Details

#options_as_stringObject



43
44
45
# File 'lib/kco_ruby/user_agent.rb', line 43

def options_as_string
  "(#{@options.join(" ; ")})" if @options
end

#to_sObject



39
40
41
# File 'lib/kco_ruby/user_agent.rb', line 39

def to_s
  ["#{@identifier}/#{@name}_#{@version}", options_as_string].join(" ").strip
end