Sha256: f6e558d309b57ae6ca7fa65116469efed113bac76d8dc84639b64195d61abbdf

Contents?: true

Size: 392 Bytes

Versions: 4

Compression:

Stored size: 392 Bytes

Contents

module Parametric
  module Utils
    def self.value(val, separator = ',')
      if val.nil?
        ''
      elsif val.is_a?(Array)
        val.join(separator)
      else
        val
      end
    end

    def self.present?(value)
      case value
      when String
        value.strip != ''
      when Array, Hash
        value.any?
      else
        !value.nil?
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
parametric-0.0.5 lib/parametric/utils.rb
parametric-0.0.4 lib/parametric/utils.rb
parametric-0.0.3 lib/parametric/utils.rb
parametric-0.0.2 lib/parametric/utils.rb