{"action":"created","issue":{"url":"https://api.github.com/repos/dkubb/equalizer/issues/20","labels_url":"https://api.github.com/repos/dkubb/equalizer/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/dkubb/equalizer/issues/20/comments","events_url":"https://api.github.com/repos/dkubb/equalizer/issues/20/events","html_url":"https://github.com/dkubb/equalizer/issues/20","id":88797513,"number":20,"title":"extended objects do not work like objects of module included classes","user":{"login":"phurni","id":95982,"avatar_url":"https://avatars.githubusercontent.com/u/95982?v=3","gravatar_id":"","url":"https://api.github.com/users/phurni","html_url":"https://github.com/phurni","followers_url":"https://api.github.com/users/phurni/followers","following_url":"https://api.github.com/users/phurni/following{/other_user}","gists_url":"https://api.github.com/users/phurni/gists{/gist_id}","starred_url":"https://api.github.com/users/phurni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phurni/subscriptions","organizations_url":"https://api.github.com/users/phurni/orgs","repos_url":"https://api.github.com/users/phurni/repos","events_url":"https://api.github.com/users/phurni/events{/privacy}","received_events_url":"https://api.github.com/users/phurni/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-16T18:02:01Z","updated_at":"2015-06-16T18:50:37Z","closed_at":null,"body":"Hi,\r\n\r\nCurrently `equalizer` only triggers when `include`'ed into a `Module`, I have a use case that fails with this assumption, here it is.\r\n\r\nI only want the equalizer functionnalities for some objects, not all object of a class, so I define the equalizer like this:\r\n\r\n```ruby\r\n  GeoLocationEqualizer = Equalizer.new(:latitude, :longitude)\r\n```\r\n\r\nThe class like that:\r\n\r\n```ruby\r\n  class GeoLocation\r\n    attr_reader :latitude, :longitude\r\n    \r\n    def initialize(latitude, longitude)\r\n      @latitude, @longitude = latitude, longitude\r\n    end\r\n  end\r\n```\r\n\r\n\r\nAnd the code using them:\r\n\r\n```ruby\r\n  restaurants = get_locations_from('http://example.com/paris/restaurants')\r\n  cafes = get_locations_from('http://example.com/paris/cafes')\r\n  \r\n  # I'm interested in comparing location only for those objects, extend them\r\n  restaurants.each { |restaurant| restaurant.extend(GeoLocationEqualizer) }\r\n  cafes.each { |cafe| cafe.extend(GeoLocationEqualizer) }\r\n  \r\n  # I want to know which cafes are on the same location as restaurants\r\n  # (Array#& uses eql? and hash)\r\n  matching = restaurants & cafes\r\n```\r\n\r\nIn the current code, the `Methods` module is not mixed in when `extend`'ing objects.\r\nFor that we have to add the `extend_object` hook like this:\r\n\r\n```ruby\r\n  def extend_object(obj)\r\n    obj.extend Methods\r\n    super\r\n  end\r\n```\r\n\r\nMay this be added to master? Should I submit a PR?\r\n\r\nRegards\r\n"},"comment":{"url":"https://api.github.com/repos/dkubb/equalizer/issues/comments/112527185","html_url":"https://github.com/dkubb/equalizer/issues/20#issuecomment-112527185","issue_url":"https://api.github.com/repos/dkubb/equalizer/issues/20","id":112527185,"user":{"login":"mbj","id":117966,"avatar_url":"https://avatars.githubusercontent.com/u/117966?v=3","gravatar_id":"","url":"https://api.github.com/users/mbj","html_url":"https://github.com/mbj","followers_url":"https://api.github.com/users/mbj/followers","following_url":"https://api.github.com/users/mbj/following{/other_user}","gists_url":"https://api.github.com/users/mbj/gists{/gist_id}","starred_url":"https://api.github.com/users/mbj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbj/subscriptions","organizations_url":"https://api.github.com/users/mbj/orgs","repos_url":"https://api.github.com/users/mbj/repos","events_url":"https://api.github.com/users/mbj/events{/privacy}","received_events_url":"https://api.github.com/users/mbj/received_events","type":"User","site_admin":false},"created_at":"2015-06-16T18:50:37Z","updated_at":"2015-06-16T18:50:37Z","body":"Nak from my side.\r\n\r\n> I only want the equalizer functionnalities for some objects, not all object of a class, so I define the equalizer like this:\r\n\r\nMake a specific subclass where you include the Equalizer, and all objects you want to be equalized instnaces of that equalized subclass. Using `Object#extend` this way is IMO just hiding a design smell."}}