equalizer icon indicating copy to clipboard operation
equalizer copied to clipboard

Equalizer causes “Undocumentable mixin” warning in YARD

Open sferik opened this issue 11 years ago • 3 comments

When using Equalizer in projects that use YARD for documentation, YARD raises a YARD::Parser::UndocumentableError on every line that mixes-in Equalizer.

I’m not sure exactly how to solve this problem. Maybe I should just silence the warnings in YARD or maybe Equalizer should change its interface to mix-in a static module and then use class methods to define which attributes to use for equality. For example:

class GeoLocation
  include Equalizer
  attr_reader :latitude, :longitude
  equalize :latitude, :longitude

  def initialize(latitude, longitude)
    @latitude, @longitude = latitude, longitude
  end
end

I’m interested to have some discussion around this issue.

/cc @lsegal

sferik avatar Feb 27 '15 12:02 sferik

Personally I was thinking about switching to include SomeModule(:foo, :bar) which shouldn't cause this error (I think?).

In general one drawback with module subclasses is that it doesn't work in RubyMotion; other than that it's a sweet technique ;)

solnic avatar Apr 29 '15 07:04 solnic

Is RubyMotion a supported platform? I didn’t see it in the list of supported Ruby versions?

sferik avatar Apr 29 '15 07:04 sferik

It is not. Unless something changed and RM supports subclassing modules now. Then we could support it.

solnic avatar Apr 29 '15 08:04 solnic