Class: Kiba::Extend::Utils::Lookup::CriteriaChecker
- Inherits:
-
Object
- Object
- Kiba::Extend::Utils::Lookup::CriteriaChecker
- Defined in:
- lib/kiba/extend/utils/lookup/criteria_checker.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(check_type:, config:, row:, mergerow: {}, sep: nil) ⇒ CriteriaChecker
constructor
A new instance of CriteriaChecker.
Constructor Details
#initialize(check_type:, config:, row:, mergerow: {}, sep: nil) ⇒ CriteriaChecker
Returns a new instance of CriteriaChecker.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/kiba/extend/utils/lookup/criteria_checker.rb', line 10 def initialize(check_type:, config:, row:, mergerow: {}, sep: nil) @check_type = check_type @config = config @row = row @mergerow = mergerow @type = @config[:type] || :all bool = [] @config[:fieldsets].each do |set| bool << Lookup::SetChecker.new( check_type: @check_type, set: set, row: @row, mergerow: @mergerow, sep: sep ).result end case @type when :any @result = bool.any? when :all @result = !bool.any?(false) end end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
8 9 10 |
# File 'lib/kiba/extend/utils/lookup/criteria_checker.rb', line 8 def result @result end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/kiba/extend/utils/lookup/criteria_checker.rb', line 8 def type @type end |