Module: FakeActiveSupport

Included in:
Fluent::AmplitudeOutput
Defined in:
lib/fluent/plugin/fake_active_support.rb

Overview

Some things we want from ActiveSupport

Instance Method Summary collapse

Instance Method Details

#blank?(var) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/fluent/plugin/fake_active_support.rb', line 13

def blank?(var)
  # rubocop:disable DoubleNegation
  var.respond_to?(:empty?) ? !!var.empty? : !var
  # rubocop:enable DoubleNegation
end

#present?(var) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/fluent/plugin/fake_active_support.rb', line 19

def present?(var)
  !blank?(var)
end

#simple_symbolize_keys(hsh) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/fluent/plugin/fake_active_support.rb', line 3

def simple_symbolize_keys(hsh)
  Hash[hsh.map do |k, v|
    begin
      [k.to_sym, v]
    rescue
      [k, v]
    end
  end]
end