Module: Paypal::Util

Defined in:
lib/paypal/util.rb

Class Method Summary collapse

Class Method Details

.blank?(value) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/paypal/util.rb', line 9

def self.blank?(value)
  value.respond_to?(:empty?) ? value.empty? : !value
end

.deep_symbolize_keys(hash) ⇒ Object



3
4
5
6
7
# File 'lib/paypal/util.rb', line 3

def self.deep_symbolize_keys(hash)
  hash.each_with_object({}) do |(key, value), memo|
    memo[key.to_sym] = value.is_a?(Hash) ? deep_symbolize_keys(value) : value
  end
end

.nowObject



17
18
19
20
21
22
23
# File 'lib/paypal/util.rb', line 17

def self.now
  if Time.respond_to?(:zone)
    Time.zone.now
  else
    Time.now
  end
end

.present?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/paypal/util.rb', line 13

def self.present?(...)
  !blank?(...)
end