Sha256: 6b57daa8e4e9d907d2bbee0fa18264557b6961a307faa6f78b762c33a8a1d6ed

Contents?: true

Size: 689 Bytes

Versions: 8

Compression:

Stored size: 689 Bytes

Contents

require 'notification-handler'
require 'active_support'

module NotificationRenderer
    module NotificationScopes

        extend ActiveSupport::Concern

        included do
            include NotificationRenderer::NotificationScopes::InstanceMethods
        end

        module InstanceMethods

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

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

        end

    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
notification-renderer-1.2.2 lib/notification_renderer/notification_scopes.rb
notification-renderer-1.2.1 lib/notification_renderer/notification_scopes.rb
notification-renderer-1.2.0 lib/notification_renderer/notification_scopes.rb
notification-renderer-1.1.2 lib/notification_renderer/notification_scopes.rb
notification-renderer-1.1.1 lib/notification_renderer/notification_scopes.rb
notification-renderer-1.1.0 lib/notification_renderer/notification_scopes.rb
notification-renderer-1.0.0 lib/notification_renderer/notification_scopes.rb
notification-renderer-1.0.0.beta11 lib/notification_renderer/notification_scopes.rb