Sha256: 50d4550e139fbc1ce6c2daa8e88f8449d3299016f96a22129e059130330a1528

Contents?: true

Size: 511 Bytes

Versions: 3

Compression:

Stored size: 511 Bytes

Contents

# frozen_string_literal: true

require 'notification-handler'
require 'active_support'

module NotificationRenderer
  module NotificationScopes
    extend ActiveSupport::Concern

    module ClassMethods
      def method_missing(method, *args)
        if method.to_s[/(.+)_type/]
          where(type: $1.singularize.classify)
        else
          super
        end
      end

      def respond_to_missing?(method, include_private = false)
        super || method.to_s[/(.+)_type/]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
notification-renderer-3.0.2 lib/notification_renderer/notification_scopes.rb
notification-renderer-2.0.0 lib/notification_renderer/notification_scopes.rb
notification-renderer-1.2.6 lib/notification_renderer/notification_scopes.rb