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
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/queueit_knownuserv3/integration_config_helpers.rb', line 222 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
254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/queueit_knownuserv3/integration_config_helpers.rb', line 254 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
208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/queueit_knownuserv3/integration_config_helpers.rb', line 208 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
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/queueit_knownuserv3/integration_config_helpers.rb', line 184 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
268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/queueit_knownuserv3/integration_config_helpers.rb', line 268 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
240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/queueit_knownuserv3/integration_config_helpers.rb', line 240 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 |