class Proof::Extend
Public Class Methods
into(obj_under_test)
click to toggle source
# File lib/proof/extend.rb, line 7 def self.into(obj_under_test) instance = new obj_under_test instance.extend_obj end
Public Instance Methods
defined()
click to toggle source
# File lib/proof/extend.rb, line 37 def defined @defined ||= mod.const_defined? :Proof, search_ancestors=false end
extend_obj()
click to toggle source
# File lib/proof/extend.rb, line 16 def extend_obj if extension.nil? Output.details "#{mod.name} not extended by #{extension_name}" return obj_under_test end Output.details "Extending #{extension_name} into #{mod.name}" Extension.! obj_under_test, extension end
extension()
click to toggle source
# File lib/proof/extend.rb, line 26 def extension return @extension if @extension Output.details "#{mod.name} has #{defined ? '' : 'no '}inner Proof" return nil unless defined Output.details "Getting constant #{mod.name}::Proof" @extension ||= mod.const_get :Proof, search_ancestors=false end
extension_name()
click to toggle source
# File lib/proof/extend.rb, line 41 def extension_name "#{mod.name}::Proof" end
mod()
click to toggle source
# File lib/proof/extend.rb, line 12 def mod @mod ||= ([Module, Class].include?(obj_under_test.class) ? obj_under_test : obj_under_test.class) end