Class: RemindMe::Reminder::RubyVersionReminder

Inherits:
BaseReminder
  • Object
show all
Includes:
Utils::Versions
Defined in:
lib/remind_me/reminder/ruby_version_reminder.rb

Constant Summary

Constants included from Utils::Versions

Utils::Versions::INSTALLED_GEMS

Instance Attribute Summary

Attributes inherited from BaseReminder

#reminder_comment_ast, #source_location

Instance Method Summary collapse

Methods included from Utils::Versions

#compare_version_numbers, #condition_comparators, #gem_installed?, #gem_version, #invalid_condition_message, #valid_condition?, #valid_version_string?

Methods inherited from BaseReminder

inherited, #inspect, #message

Methods included from Utils::HashASTManipulations

#apply_to_hash_with, #ast_hash_pair, #children_of_type, #create_hash_value_accessor_method, #create_reminder_from_ast, #hash_ast_pair_value, #hash_ast_pair_value_type, #key_present?, #singleton_method_defined?, #valid_hash_ast_key?, #valid_hash_ast_value?, #validate_hash_ast

Instance Method Details

#conditions_met?Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
# File 'lib/remind_me/reminder/ruby_version_reminder.rb', line 16

def conditions_met?
  condition = hash_condition
  target_ruby_version = Gem::Version.new(hash_ruby_version)
  installed_ruby_version = Gem::Version.new(RUBY_VERSION)
  compare_version_numbers(target_ruby_version, installed_ruby_version, condition)
end

#validation_errorsObject



23
24
25
26
27
28
29
# File 'lib/remind_me/reminder/ruby_version_reminder.rb', line 23

def validation_errors
  errors = super
  errors << invalid_ruby_version_message if hash_ruby_version.nil? || hash_ruby_version == ''
  errors << malformed_version_string_message unless valid_version_string?(hash_ruby_version)
  errors << invalid_condition_message(source_location, hash_condition) unless valid_condition?(hash_condition)
  errors
end