Class: Rpush::ReflectionCollection
- Inherits:
-
Object
- Object
- Rpush::ReflectionCollection
- Defined in:
- lib/rpush/reflection_collection.rb
Defined Under Namespace
Classes: NoSuchReflectionError
Constant Summary collapse
- REFLECTIONS =
[ :apns_feedback, :notification_enqueued, :notification_delivered, :notification_failed, :notification_will_retry, :fcm_delivered_to_recipient, :fcm_failed_to_recipient, :fcm_canonical_id, :fcm_invalid_device_token, :error, :adm_canonical_id, :adm_failed_to_recipient, :wns_invalid_channel, :ssl_certificate_will_expire, :ssl_certificate_revoked, :notification_id_will_retry, :notification_id_failed ]
- DEPRECATIONS =
{}
Instance Method Summary collapse
- #__dispatch(reflection, *args) ⇒ Object
-
#initialize ⇒ ReflectionCollection
constructor
A new instance of ReflectionCollection.
Constructor Details
#initialize ⇒ ReflectionCollection
Returns a new instance of ReflectionCollection.
25 26 27 |
# File 'lib/rpush/reflection_collection.rb', line 25 def initialize @reflections = {} end |
Instance Method Details
#__dispatch(reflection, *args) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rpush/reflection_collection.rb', line 29 def __dispatch(reflection, *args) blk = @reflections[reflection] if blk blk.call(*args) if DEPRECATIONS.key?(reflection) replacement, removal_version = DEPRECATIONS[reflection] Rpush::Deprecation.warn("#{reflection} is deprecated and will be removed in version #{removal_version}. Use #{replacement} instead.") end elsif !REFLECTIONS.include?(reflection) raise NoSuchReflectionError, reflection end end |