Skip to content

Instantly share code, notes, and snippets.

@jsuchal
Created January 14, 2013 21:43
Show Gist options
  • Select an option

  • Save jsuchal/4533802 to your computer and use it in GitHub Desktop.

Select an option

Save jsuchal/4533802 to your computer and use it in GitHub Desktop.
class SRPViolationError < StandardError
def initialize(klass)
@klass = klass
end
def message
"Class #{@klass} surely does something AND detects SRP violation, right? Well, your class should do only one thing! :D"
end
end
module SRPViolationMixin
def self.included(base)
raise SRPViolationError.new(base)
end
end
class Object
def acts_as_srp_violation
include SRPViolationMixin
end
end
class MyCleanClass
acts_as_srp_violation
def go
puts 'Go!'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment