Sha256: 79dccba1cf03a58e51aed0d4ccaec29092f88e66c2d1c0115edba4b137c4ed84

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

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

2 entries across 2 versions & 1 rubygems

Version Path
notification-renderer-1.0.0.beta10 lib/notification_renderer/notification_scopes.rb
notification-renderer-1.0.0.beta9 lib/notification_renderer/notification_scopes.rb