Sha256: 59d12396d001d962df5abdcdec8a4dc575be3994ec5ee4e4307e372b1c919f7f

Contents?: true

Size: 1014 Bytes

Versions: 3

Compression:

Stored size: 1014 Bytes

Contents

module AuxiliaryAddons
  module RubyAddons
    # ::Rails.logger.error("...")

    # Check present of object
    def is_object_here?(obj)
      return false if obj.nil?
      return true
    end

    # Check present not empty of string
    def is_string_here?(str)
      return false if str.nil?
      return false if str.blank?
      return true
    end

    # TODO: make paramters as hash articles
    # Check present not empty of string
    def is_array_items_here?(array1, array2, array3)
      return true if array1.size() > 0
      return true if array2.size() > 0
      return true if array3.size() > 0
      return false
    end

    # Convert params to arrary of ids
    def cast_ids_to_i(params)
      ids = []
      ids << params["id"].to_i if !params["id"].nil?
      if !params["ids"].nil?
        params["ids"].each do |id|
          next if id.to_i == 0 # Special case: all selected
          ids << id.to_i
        end
      end
      ids
    end


  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
auxiliary_addons-0.5.6 lib/auxiliary_addons/ruby_addons.rb
auxiliary_addons-0.5.5 lib/auxiliary_addons/ruby_addons.rb
auxiliary_addons-0.5.4 lib/auxiliary_addons/ruby_addons.rb