module SkillsCardsValidations::DataValidations
Public Instance Methods
ft_one_and_others_filled_out?(provider)
click to toggle source
# File lib/skills_cards_validations/data_validations.rb, line 73 def ft_one_and_others_filled_out?(provider) if provider.to_s.split('').first == "1" && provider.to_s.length > 1 return Valid.new(provider) end Invalid.new(provider) end
ft_two_and_others_filled_out?(provider)
click to toggle source
# File lib/skills_cards_validations/data_validations.rb, line 80 def ft_two_and_others_filled_out?(provider) if provider.to_s.split('').first == "2" && provider.to_s.length > 1 return Valid.new(provider) end Invalid.new(provider) end
interaction?(is)
click to toggle source
# File lib/skills_cards_validations/data_validations.rb, line 50 def interaction?(is) # S, A, I if is.to_s == 'S' || is.to_s == 'A' || is.to_s == 'I' return Valid.new(is) end Invalid.new(is) end
interaction_sign?(is)
click to toggle source
# File lib/skills_cards_validations/data_validations.rb, line 30 def interaction_sign?(is) # +, - if is.to_s == '+' || is.to_s == '-' return Valid.new(is) end Invalid.new(is) end
line?(l)
click to toggle source
# File lib/skills_cards_validations/data_validations.rb, line 6 def line?(l) # 1 - 23 if l.to_i.between?(1, 23) return Valid.new(l) end Invalid.new(l) end
more_than_two_providers_filled_out?(provider)
click to toggle source
# File lib/skills_cards_validations/data_validations.rb, line 87 def more_than_two_providers_filled_out?(provider) if provider.to_s.length > 2 return Valid.new(provider) end Invalid.new(provider) end
pc_and_is?(pc, is)
click to toggle source
# File lib/skills_cards_validations/data_validations.rb, line 38 def pc_and_is?(pc, is) # Positive Correction and Interaction Sign. # If PC is filled out, IS must be + # PC cannot be filled out when IS is - if pc.to_s.downcase == 'true' && is.to_s == '+' return Valid.new([pc, is]) elsif pc.to_s.downcase == 'false' && (is.to_s == '+' || is.to_s == '-') return Valid.new([pc, is]) end Invalid.new([pc, is]) end
positive_correction?(pc)
click to toggle source
# File lib/skills_cards_validations/data_validations.rb, line 22 def positive_correction?(pc) # True or False if pc.to_s.downcase == 'true' || pc.to_s.downcase == 'false' || pt.to_s == '' return Valid.new(pc) end Invalid.new(pc) end
preventative_teaching?(pt)
click to toggle source
# File lib/skills_cards_validations/data_validations.rb, line 94 def preventative_teaching?(pt) # True or False if pt.to_s.downcase == 'true' || pt.to_s.downcase == 'false' || pt.to_s == '' return Valid.new(pt) end Invalid.new(pt) end
provider?(pr)
click to toggle source
# File lib/skills_cards_validations/data_validations.rb, line 58 def provider?(pr) # A combinational logic representing a pattern # of bubbling the skills card a certain way. # The first two bubbles (FT1 and FT2, e.g. 1 and 2) # cannot be combined with any of the other bubbles # (A1 - A4, e.g. 3 - 6). if pr.to_i.between?(1, 6) || pr.to_i.between?(34, 36) || pr.to_i.between?(45, 46) || pr.to_i == 56 return Valid.new(pr) end Invalid.new(pr) end
pt_and_is_and_pc?(pt, is, pc)
click to toggle source
# File lib/skills_cards_validations/data_validations.rb, line 102 def pt_and_is_and_pc?(pt, is, pc) if pt.to_s.downcase == 'true' && is.to_s == '+' && pc.to_s.downcase != 'true' return Valid.new([pt, is, pc]) end Invalid.new([pt, is, pc]) end
skill?(s)
click to toggle source
# File lib/skills_cards_validations/data_validations.rb, line 14 def skill?(s) # 0 - 99 if s.to_i > 0 && s.to_i < 100 return Valid.new(s) end Invalid.new(s) end