Module: Queries::Helpers
- Included in:
- AlternateValue::Filter, Citation::Filter, CollectingEvent::Filter, Concerns::DataAttributes, Concerns::Identifiers, ControlledVocabularyTerm::Filter, Descriptor::Filter, DwcOccurrence::Filter, Loan::Filter, SqedDepiction::Filter, TaxonName::Tabular
- Defined in:
- lib/queries/helpers.rb
Instance Method Summary collapse
Instance Method Details
#boolean_param(params, attribute) ⇒ Boolean?
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/queries/helpers.rb', line 6 def boolean_param(params, attribute) return nil if attribute.nil? || params[attribute].nil? case params[attribute].class.name when 'TrueClass', 'FalseClass' params[attribute] when 'String' params[attribute].downcase == 'true' ? true : false when 'Symbol' params[attribute].to_s.downcase == 'true' ? true : false else puts Rainbow(params[attribute].class.name.to_s).purple raise end end |