Class: Verizon::Comparitor
- Inherits:
-
Object
- Object
- Verizon::Comparitor
- Defined in:
- lib/verizon/models/comparitor.rb
Overview
The boolean of the comparison. ‘gt` is Greater Than, `lt` is Less Than and `eq` is Equal To
Constant Summary collapse
- COMPARITOR =
[ # TODO: Write general description for GT GT = 'gt'.freeze, # TODO: Write general description for LT LT = 'lt'.freeze, # TODO: Write general description for EQ EQ = 'eq'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = GT) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/verizon/models/comparitor.rb', line 27 def self.from_value(value, default_value = GT) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'gt' then GT when 'lt' then LT when 'eq' then EQ else default_value end end |
.validate(value) ⇒ Object
21 22 23 24 25 |
# File 'lib/verizon/models/comparitor.rb', line 21 def self.validate(value) return false if value.nil? COMPARITOR.include?(value) end |