Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
Check for #hash
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Dec 6, 2016
1 parent 61e399b commit 7921a4d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/timber/events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def self.build(obj)
Events::Custom.new(
type: obj.type,
message: obj.message,
data: obj.to_h
data: obj.respond_to?(:hash) ? obj.hash : obj.to_h # ruby 1.9.3 does not have to_h
)
else
nil
Expand Down
2 changes: 1 addition & 1 deletion spec/timber/events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def to_timber_event
Timber::Events::Custom.new(
type: :payment_rejected,
message: "Payment rejected for #{customer_id}",
data: to_h
data: respond_to?(:hash) ? hash : to_hash
)
end
end
Expand Down

0 comments on commit 7921a4d

Please sign in to comment.