Module: Bsm::Constrainable::Util

Extended by:
Util
Included in:
FilterSet, Util
Defined in:
lib/bsm/constrainable/util.rb

Instance Method Summary collapse

Instance Method Details

#normalized_array(array) ⇒ Object



8
9
10
11
12
13
# File 'lib/bsm/constrainable/util.rb', line 8

def normalized_array(array)
  array = array.keys if array.is_a?(Hash)
  Array.wrap(array).map do |item|
    item.to_s.split('|')
  end.flatten.reject(&:blank?).uniq
end

#normalized_hash(hash) ⇒ Object



4
5
6
# File 'lib/bsm/constrainable/util.rb', line 4

def normalized_hash(hash)
  hash.is_a?(Hash) ? hash.stringify_keys : {}
end