Class: Applitools::AppEnvironment
- Inherits:
-
Object
- Object
- Applitools::AppEnvironment
- Defined in:
- lib/applitools/core/app_environment.rb
Instance Attribute Summary collapse
-
#device_info ⇒ Object
Returns the value of attribute device_info.
-
#display_size ⇒ Object
Returns the value of attribute display_size.
-
#hosting_app ⇒ Object
Returns the value of attribute hosting_app.
-
#inferred_environment ⇒ Object
Returns the value of attribute inferred_environment.
-
#os ⇒ Object
Returns the value of attribute os.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ AppEnvironment
constructor
A new instance of AppEnvironment.
- #json_data ⇒ Object
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ AppEnvironment
Returns a new instance of AppEnvironment.
7 8 9 10 11 12 13 |
# File 'lib/applitools/core/app_environment.rb', line 7 def initialize( = {}) self.os = [:os] self.hosting_app = [:hosting_app] self.display_size = [:display_size] self.inferred_environment = [:inferred] self.device_info = [:device_info] end |
Instance Attribute Details
#device_info ⇒ Object
Returns the value of attribute device_info.
5 6 7 |
# File 'lib/applitools/core/app_environment.rb', line 5 def device_info @device_info end |
#display_size ⇒ Object
Returns the value of attribute display_size.
5 6 7 |
# File 'lib/applitools/core/app_environment.rb', line 5 def display_size @display_size end |
#hosting_app ⇒ Object
Returns the value of attribute hosting_app.
5 6 7 |
# File 'lib/applitools/core/app_environment.rb', line 5 def hosting_app @hosting_app end |
#inferred_environment ⇒ Object
Returns the value of attribute inferred_environment.
5 6 7 |
# File 'lib/applitools/core/app_environment.rb', line 5 def inferred_environment @inferred_environment end |
#os ⇒ Object
Returns the value of attribute os.
5 6 7 |
# File 'lib/applitools/core/app_environment.rb', line 5 def os @os end |
Instance Method Details
#json_data ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/applitools/core/app_environment.rb', line 15 def json_data { 'os' => os, 'hostingApp' => hosting_app, 'displaySize' => display_size && display_size.to_hash, 'inferred' => inferred_environment, 'deviceInfo' => device_info.nil? || device_info.empty? ? 'Desktop' : device_info } end |
#to_hash ⇒ Object
25 26 27 |
# File 'lib/applitools/core/app_environment.rb', line 25 def to_hash json_data end |
#to_s ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/applitools/core/app_environment.rb', line 29 def to_s result = '' to_hash.each_pair do |k, v| result << "#{k}: #{v}; " end result end |