Class: ArraySet
- Inherits:
-
Array
- Object
- Array
- ArraySet
- Defined in:
- lib/json-schema/util/array_set.rb
Overview
This is a hack that I don’t want to ever use anywhere else or repeat EVER, but we need enums to be an Array to pass schema validation. But we also want fast lookup!
Instance Method Summary collapse
Instance Method Details
#include?(obj) ⇒ Boolean
7 8 9 10 11 12 13 |
# File 'lib/json-schema/util/array_set.rb', line 7 def include?(obj) if !defined? @values @values = Set.new each { |x| @values << convert_to_float_if_numeric(x) } end @values.include?(convert_to_float_if_numeric(obj)) end |