Module: Troles::Common::Api::Validation
- Defined in:
- lib/troles/common/api/validation.rb
Instance Method Summary collapse
-
#check_valid_role?(role) ⇒ Symbol, false
Returns the role if it’s valid, false if not.
-
#check_valid_roles?(*roles) ⇒ Array<Symbol>
Returns the valid roles or empty list if no valid roles.
Instance Method Details
#check_valid_role?(role) ⇒ Symbol, false
Returns the role if it’s valid, false if not
10 11 12 13 |
# File 'lib/troles/common/api/validation.rb', line 10 def check_valid_role? role return role if valid_roles.include? role.to_sym false end |
#check_valid_roles?(*roles) ⇒ Array<Symbol>
Returns the valid roles or empty list if no valid roles
16 17 18 |
# File 'lib/troles/common/api/validation.rb', line 16 def check_valid_roles? *roles valid_roles & roles.to_symbols end |