lib/arborist/event.rb in arborist-0.2.0.pre20170519125456 vs lib/arborist/event.rb in arborist-0.2.0
- old
+ new
@@ -56,12 +56,28 @@
### Return the event as a Hash.
def to_h
return {
- 'type' => self.type,
- 'data' => self.payload
+ type: self.type,
+ data: self.payload
}
+ end
+
+
+ ### Return a string representation of the object suitable for debugging.
+ def inspect
+ return "#<%p:%#016x %s>" % [
+ self.class,
+ self.object_id * 2,
+ self.inspect_details,
+ ]
+ end
+
+
+ ### Return the detail portion of the #inspect string appropriate for this event type.
+ def inspect_details
+ return self.payload.inspect
end
end # class Arborist::Event