lib/wcc/contentful/event.rb in wcc-contentful-1.2.0 vs lib/wcc/contentful/event.rb in wcc-contentful-1.2.1
- old
+ new
@@ -21,13 +21,11 @@
@event_types[name] || WCC::Contentful::Event::Unknown
end
def register(constant)
name = constant.try(:type) || constant.name.demodulize
- unless constant.respond_to?(:new)
- raise ArgumentError, "Constant #{constant} does not define 'new'"
- end
+ raise ArgumentError, "Constant #{constant} does not define 'new'" unless constant.respond_to?(:new)
@event_types ||= {}
@event_types[name] = constant
end
end
@@ -56,9 +54,10 @@
end
attr_reader :sys
attr_reader :raw
attr_reader :source
+
delegate :id, to: :sys
delegate :type, to: :sys
delegate :created_at, to: :sys
delegate :updated_at, to: :sys
delegate :revision, to: :sys