module ConvenientGrouper

Constants

VERSION

Public Instance Methods

get_groups(hc, hash_arg) click to toggle source
# File lib/convenient_grouper.rb, line 25
def get_groups(hc, hash_arg)
  hc.try(:groups) || hash_arg
end
get_hash_converter(hash_arg, opts) click to toggle source
# File lib/convenient_grouper.rb, line 20
def get_hash_converter(hash_arg, opts)
  return unless hash_arg.is_a?(Hash)
  ConvenientGrouper::HashConverter.new(hash_arg, opts)
end
get_restrictions(hc) click to toggle source
# File lib/convenient_grouper.rb, line 29
def get_restrictions(hc)
  hc.try(:restrictions) || ""
end
preliminaries(hash_arg, opts) click to toggle source
# File lib/convenient_grouper.rb, line 8
def preliminaries(hash_arg, opts)
  hc = get_hash_converter(hash_arg, opts)

  {
    groups: get_groups(hc, hash_arg),
    restrictions: get_restrictions(hc)
  }
end