Module: TroleGroups::Api::Validation

Defined in:
lib/trole_groups/api/validation.rb

Instance Method Summary collapse

Instance Method Details

#check_valid_rolegroup?(rolegroup) ⇒ Symbol, false

Returns the role if it’s valid, false if not

Returns:

  • (Symbol, false)

    returns the role if it’s valid, false if not



10
11
12
13
# File 'lib/trole_groups/api/validation.rb', line 10

def check_valid_rolegroup? rolegroup
  return rolegroup if valid_rolegroups.include? rolegroup.to_sym
  false
end

#check_valid_rolegroups?(*rolegroups) ⇒ Array<Symbol>

Returns the valid roles or empty list if no valid roles

Returns:

  • (Array<Symbol>)

    returns the valid roles or empty list if no valid roles



16
17
18
# File 'lib/trole_groups/api/validation.rb', line 16

def check_valid_rolegroups? *rolegroups
  valid_rolegroups & rolegroups.to_symbols     
end