Module: MuchRails::InputValue

Defined in:
lib/much-rails/input_value.rb

Overview

MuchRails::InputValue is a utility module for dealing with input field values.

Class Method Summary collapse

Class Method Details

.strip(value) ⇒ Object



7
8
9
10
11
# File 'lib/much-rails/input_value.rb', line 7

def self.strip(value)
  return if value.blank?

  value.to_s.strip.presence
end

.strip_all(values) ⇒ Object



13
14
15
16
17
18
# File 'lib/much-rails/input_value.rb', line 13

def self.strip_all(values)
  Array
    .wrap(values)
    .map{ |value| strip(value) }
    .compact
end