Class: QueueIt::ComparisonOperatorHelper
- Inherits:
-
Object
- Object
- QueueIt::ComparisonOperatorHelper
- Defined in:
- lib/queueit_knownuserv3/integration_config_helpers.rb
Class Method Summary collapse
- .contains(left, right, isNegative, ignoreCase) ⇒ Object
- .endsWith(left, right, isNegative, ignoreCase) ⇒ Object
- .equals(left, right, isNegative, ignoreCase) ⇒ Object
- .evaluate(opt, isNegative, ignoreCase, left, right) ⇒ Object
- .matchesWith(left, right, isNegative, ignoreCase) ⇒ Object
- .startsWith(left, right, isNegative, ignoreCase) ⇒ Object
Class Method Details
.contains(left, right, isNegative, ignoreCase) ⇒ Object
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/queueit_knownuserv3/integration_config_helpers.rb', line 204 def self.contains(left, right, isNegative, ignoreCase) if(right.eql? "*") return true end if(ignoreCase) left = left.upcase right = right.upcase end evaluation = left.include? right if(isNegative) return !evaluation else return evaluation end end |
.endsWith(left, right, isNegative, ignoreCase) ⇒ Object
236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/queueit_knownuserv3/integration_config_helpers.rb', line 236 def self.endsWith(left, right, isNegative, ignoreCase) if(ignoreCase) evaluation = left.upcase.end_with? right.upcase else evaluation = left.end_with? right end if(isNegative) return !evaluation else return evaluation end end |
.equals(left, right, isNegative, ignoreCase) ⇒ Object
190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/queueit_knownuserv3/integration_config_helpers.rb', line 190 def self.equals(left, right, isNegative, ignoreCase) if(ignoreCase) evaluation = left.upcase.eql? right.upcase else evaluation = left.eql? right end if(isNegative) return !evaluation else return evaluation end end |
.evaluate(opt, isNegative, ignoreCase, left, right) ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/queueit_knownuserv3/integration_config_helpers.rb', line 166 def self.evaluate(opt, isNegative, ignoreCase, left, right) if(left.nil?) left = '' end if(right.nil?) right = '' end case opt when "Equals" return ComparisonOperatorHelper.equals(left, right, isNegative, ignoreCase) when "Contains" return ComparisonOperatorHelper.contains(left, right, isNegative, ignoreCase) when "StartsWith" return ComparisonOperatorHelper.startsWith(left, right, isNegative, ignoreCase) when "EndsWith" return ComparisonOperatorHelper.endsWith(left, right, isNegative, ignoreCase) when "MatchesWith" return ComparisonOperatorHelper.matchesWith(left, right, isNegative, ignoreCase) else return false end end |
.matchesWith(left, right, isNegative, ignoreCase) ⇒ Object
250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/queueit_knownuserv3/integration_config_helpers.rb', line 250 def self.matchesWith(left, right, isNegative, ignoreCase) if(ignoreCase) pattern = Regexp.new(right, Regexp::IGNORECASE) else pattern = Regexp.new(right) end evaluation = pattern.match(left) != nil if(isNegative) return !evaluation else return evaluation end end |
.startsWith(left, right, isNegative, ignoreCase) ⇒ Object
222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/queueit_knownuserv3/integration_config_helpers.rb', line 222 def self.startsWith(left, right, isNegative, ignoreCase) if(ignoreCase) evaluation = left.upcase.start_with? right.upcase else evaluation = left.start_with? right end if(isNegative) return !evaluation else return evaluation end end |