Class: Calabash::Cucumber::Preferences
- Inherits:
-
Object
- Object
- Calabash::Cucumber::Preferences
- Defined in:
- lib/calabash-cucumber/store/preferences.rb
Overview
Users preferences persisted across runs:
~/.calabash/preferences/preferences.json
Instance Method Summary collapse
-
#usage_tracking ⇒ Object
!@visibility private.
-
#usage_tracking=(value) ⇒ Object
!@visibility private.
-
#user_id ⇒ Object
!@visibility private.
-
#user_id=(value) ⇒ Object
!@visibility private.
Instance Method Details
#usage_tracking ⇒ Object
!@visibility private
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/calabash-cucumber/store/preferences.rb', line 32 def usage_tracking preferences = read unless valid_user_tracking_value?(preferences[:usage_tracking]) log_defaults_reset preferences[:usage_tracking] = defaults[:usage_tracking] write(preferences) end preferences[:usage_tracking] end |
#usage_tracking=(value) ⇒ Object
!@visibility private
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/calabash-cucumber/store/preferences.rb', line 45 def usage_tracking=(value) if !valid_user_tracking_value?(value) raise ArgumentError, "Expected '#{value}' to be one of #{VALID_USAGE_TRACKING_VALUES.join(", ")}" end preferences = read preferences[:usage_tracking] = value write(preferences) end |
#user_id ⇒ Object
!@visibility private
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/calabash-cucumber/store/preferences.rb', line 57 def user_id preferences = read unless valid_user_id?(preferences[:user_id]) preferences[:user_id] = SecureRandom.uuid write(preferences) end preferences[:user_id] end |
#user_id=(value) ⇒ Object
!@visibility private
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/calabash-cucumber/store/preferences.rb', line 69 def user_id=(value) if !valid_user_id?(value) raise ArgumentError, "Expected '#{value}' to not be nil and not an empty string" end preferences = read preferences[:user_id] = value write(preferences) end |