Created
October 22, 2015 09:39
-
-
Save umar-siddiqui/d1a7b6de039409bb342b to your computer and use it in GitHub Desktop.
conditions evaluation in rb file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.select do |ind_user_access| | |
condition = ind_user_access.move.conditions.first | |
next true if condition.nil? | |
next false unless object.attributes[condition.indicator_attribute.name] | |
eval_str = "#{object.attributes[condition.indicator_attribute.name]}" \ | |
" #{condition.operator}" \ | |
" #{condition.value}" | |
next true if eval(eval_str) | |
false | |
end | |
.map(&:users).flatten |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment