module Dug::Validations
Public Instance Methods
valid_reason?(reason)
click to toggle source
# File lib/dug/validations.rb, line 13 def valid_reason?(reason) GITHUB_REASONS.include?(reason.to_s) end
valid_rule_type?(type)
click to toggle source
# File lib/dug/validations.rb, line 3 def valid_rule_type?(type) LABEL_RULE_TYPES.include?(type.to_s) end
valid_state?(state)
click to toggle source
# File lib/dug/validations.rb, line 23 def valid_state?(state) ISSUE_STATES.include?(state.to_s) end
validate_reason!(reason)
click to toggle source
# File lib/dug/validations.rb, line 17 def validate_reason!(reason) unless valid_reason?(reason) raise InvalidGitHubReason, "'#{reason}' is not a valid GitHub notification reason. Valid reasons include: #{GITHUB_REASONS.map { |x| "'#{x}'" }.join(', ')}" end end
validate_rule_type!(type)
click to toggle source
# File lib/dug/validations.rb, line 7 def validate_rule_type!(type) unless valid_rule_type?(type) raise InvalidRuleType, "'#{type}' is not a valid label rule type. Valid types: #{LABEL_RULE_TYPES}" end end
validate_state!(state)
click to toggle source
# File lib/dug/validations.rb, line 27 def validate_state!(state) unless valid_state?(state) raise InvalidIssueState, "'#{state}' is not a valid issue state. Valid reasons include: #{ISSUE_STATES.map { |x| "'#{x}'" }.join(', ')}" end end