Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefinition warnings in SupportsFeatureMixin #20416

Closed
djberg96 opened this issue Aug 5, 2020 · 0 comments
Closed

Redefinition warnings in SupportsFeatureMixin #20416

djberg96 opened this issue Aug 5, 2020 · 0 comments

Comments

@djberg96
Copy link
Contributor

djberg96 commented Aug 5, 2020

With warnings enabled you'll see that the SupportsFeatureMixin triggers lots of redefinition warnings:

# sf_test.rb
require 'active_support'
require 'active_support/core_ext/object/blank'
require_relative 'supports_feature_mixin' # Assume sf_test.rb and supports_feature_mixin.rb are in same directory

class Post
  include SupportsFeatureMixin
  supports :publish
  supports_not :migrate, :reason => 'Migrate not supported'
end

p Post.supports?(:publish)
p Post.supports?(:migrate)

=begin
>ruby -w sf_test.rb
/Users/dberger/Programming/Ruby/supports_feature_mixin.rb:264: warning: method redefined; discarding old supports_publish?
/Users/dberger/Programming/Ruby/supports_feature_mixin.rb:264: warning: previous definition of supports_publish? was here
/Users/dberger/Programming/Ruby/supports_feature_mixin.rb:280: warning: method redefined; discarding old supports_publish?
/Users/dberger/Programming/Ruby/supports_feature_mixin.rb:280: warning: previous definition of supports_publish? was here
/Users/dberger/Programming/Ruby/supports_feature_mixin.rb:264: warning: method redefined; discarding old supports_migrate?
/Users/dberger/Programming/Ruby/supports_feature_mixin.rb:264: warning: previous definition of supports_migrate? was here
/Users/dberger/Programming/Ruby/supports_feature_mixin.rb:280: warning: method redefined; discarding old supports_migrate?
/Users/dberger/Programming/Ruby/supports_feature_mixin.rb:280: warning: previous definition of supports_migrate? was here
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants