Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created January 26, 2016 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/82fb4158315cbc2dcfc6 to your computer and use it in GitHub Desktop.
Save anonymous/82fb4158315cbc2dcfc6 to your computer and use it in GitHub Desktop.
Code:
puts "#start"
puts type_name
puts record.has_key?("_type")
type_name = record[:_type] if record.has_key?("_type")
puts type_name
puts "#end"
Log:
#start
fluentd
true
#end
Why type_name set to nil ?
@nnovikov
Copy link

Code:
p "#start"
p type_name
p record.has_key?("_type")
type_name = record["_type"] if record.has_key?("_type")
p type_name
p "#end"

Logs:
"#start"
"fluentd"
false
nil
"#end"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment