Sha256: feede422b98b1049e2a926a542fb671ba261abf3316d114fd65086c7b2228a64

Contents?: true

Size: 369 Bytes

Versions: 1

Compression:

Stored size: 369 Bytes

Contents

module Parametric
  module Utils
    def self.value(val)
      if val.nil?
        ''
      elsif val.is_a?(Array)
        val.join(',')
      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

1 entries across 1 versions & 1 rubygems

Version Path
parametric-0.0.1 lib/parametric/utils.rb