Class: ConvenientService::RSpec::PrimitiveMatchers::Classes::SingletonPrependModule
- Inherits:
-
Object
- Object
- ConvenientService::RSpec::PrimitiveMatchers::Classes::SingletonPrependModule
- Defined in:
- lib/convenient_service/rspec/primitive_matchers/classes/singleton_prepend_module.rb
Instance Method Summary collapse
- #description ⇒ String
- #failure_message ⇒ String
- #failure_message_when_negated ⇒ String
- #initialize(mod) ⇒ void constructor
- #matches?(klass) ⇒ Boolean
Constructor Details
#initialize(mod) ⇒ void
27 28 29 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/singleton_prepend_module.rb', line 27 def initialize(mod) @mod = mod end |
Instance Method Details
#description ⇒ String
44 45 46 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/singleton_prepend_module.rb', line 44 def description "`singleton_class.prepend` module `#{mod}`" end |
#failure_message ⇒ String
51 52 53 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/singleton_prepend_module.rb', line 51 def "expected `#{klass}` to `singleton_class.prepend` module `#{mod}`" end |
#failure_message_when_negated ⇒ String
58 59 60 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/singleton_prepend_module.rb', line 58 def "expected `#{klass}` NOT to `singleton_class.prepend` module `#{mod}`" end |
#matches?(klass) ⇒ Boolean
35 36 37 38 39 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/singleton_prepend_module.rb', line 35 def matches?(klass) @klass = klass klass.singleton_class.ancestors.take_while { |ancestor| ancestor != klass }.include?(mod) end |