Class: UserAgent
- Inherits:
-
Object
- Object
- UserAgent
- Defined in:
- lib/kill_switch/user_agent.rb
Instance Attribute Summary collapse
-
#app_version ⇒ Object
readonly
Returns the value of attribute app_version.
-
#device_model ⇒ Object
readonly
Returns the value of attribute device_model.
-
#device_os_version ⇒ Object
readonly
Returns the value of attribute device_os_version.
-
#device_platform ⇒ Object
readonly
Returns the value of attribute device_platform.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
-
#initialize(user_agent_string) ⇒ UserAgent
constructor
A new instance of UserAgent.
- #valid? ⇒ Boolean
Constructor Details
#initialize(user_agent_string) ⇒ UserAgent
Returns a new instance of UserAgent.
8 9 10 11 |
# File 'lib/kill_switch/user_agent.rb', line 8 def initialize(user_agent_string) @string = user_agent_string parse_string end |
Instance Attribute Details
#app_version ⇒ Object (readonly)
Returns the value of attribute app_version.
2 3 4 |
# File 'lib/kill_switch/user_agent.rb', line 2 def app_version @app_version end |
#device_model ⇒ Object (readonly)
Returns the value of attribute device_model.
3 4 5 |
# File 'lib/kill_switch/user_agent.rb', line 3 def device_model @device_model end |
#device_os_version ⇒ Object (readonly)
Returns the value of attribute device_os_version.
4 5 6 |
# File 'lib/kill_switch/user_agent.rb', line 4 def device_os_version @device_os_version end |
#device_platform ⇒ Object (readonly)
Returns the value of attribute device_platform.
5 6 7 |
# File 'lib/kill_switch/user_agent.rb', line 5 def device_platform @device_platform end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
6 7 8 |
# File 'lib/kill_switch/user_agent.rb', line 6 def string @string end |
Instance Method Details
#valid? ⇒ Boolean
13 14 15 16 17 18 19 |
# File 'lib/kill_switch/user_agent.rb', line 13 def valid? @parsed_successfully && !@app_version.to_s.empty? && !@device_model.to_s.empty? && !@device_os_version.to_s.empty? && !@device_platform.to_s.empty? end |