Module: EvoleapLicensing::ControlLogic
- Defined in:
- lib/evoleap_licensing/control_logic.rb
Class Method Summary collapse
- .first_launch_time_valid?(first_launch_time, current_time) ⇒ Boolean
- .in_grace_period_for_unregistered_product?(strategy, first_launch_time, current_time) ⇒ Boolean
- .in_grace_period_for_validation_failures?(grace_period, number_of_failed_attempts, last_successful_time, current_time) ⇒ Boolean
- .time_inconsistency_detected?(last_trusted_time, previous_times, current_time, current_time_is_trusted) ⇒ Boolean
Class Method Details
.first_launch_time_valid?(first_launch_time, current_time) ⇒ Boolean
5 6 7 |
# File 'lib/evoleap_licensing/control_logic.rb', line 5 def self.first_launch_time_valid?(first_launch_time, current_time) current_time >= first_launch_time end |
.in_grace_period_for_unregistered_product?(strategy, first_launch_time, current_time) ⇒ Boolean
17 18 19 20 21 22 23 |
# File 'lib/evoleap_licensing/control_logic.rb', line 17 def self.in_grace_period_for_unregistered_product?(strategy, first_launch_time, current_time) return [false, nil] if strategy.grace_period_for_unregistered_product <= 0 expiration = first_launch_time + strategy.grace_period_for_unregistered_product ok = current_time < expiration [ok, expiration] end |
.in_grace_period_for_validation_failures?(grace_period, number_of_failed_attempts, last_successful_time, current_time) ⇒ Boolean
25 26 27 28 29 30 31 |
# File 'lib/evoleap_licensing/control_logic.rb', line 25 def self.in_grace_period_for_validation_failures?(grace_period, number_of_failed_attempts, last_successful_time, current_time) return [false, nil] if last_successful_time.nil? || grace_period.nil? || grace_period <= 0 expiration = last_successful_time + grace_period ok = number_of_failed_attempts == 0 || current_time < expiration [ok, expiration] end |
.time_inconsistency_detected?(last_trusted_time, previous_times, current_time, current_time_is_trusted) ⇒ Boolean
9 10 11 12 13 14 15 |
# File 'lib/evoleap_licensing/control_logic.rb', line 9 def self.time_inconsistency_detected?(last_trusted_time, previous_times, current_time, current_time_is_trusted) return false if last_trusted_time.nil? return false if current_time_is_trusted time_to_check = get_time_to_check(previous_times, last_trusted_time) current_time < time_to_check end |