Module: Revector::Exists

Defined in:
lib/revector/predicate/exists.rb

Class Method Summary collapse

Class Method Details

.check!(item, iteratee) ⇒ Object



5
6
7
# File 'lib/revector/predicate/exists.rb', line 5

def self.check!(item, iteratee)
  compare(Utility::TryFetchOrBlank[item, iteratee])
end

.compare(value, other = false) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/revector/predicate/exists.rb', line 9

def self.compare(value, other = false)
  case value
  in [*] | String
    value.size.positive?.to_s == other.to_s
  else
    !!value.to_s == other.to_s
  end
end