Class: Stub::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/stub/abstract.rb

Direct Known Subclasses

Template::Abstract

Defined Under Namespace

Modules: Methods

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Abstract

Returns a new instance of Abstract.



11
12
13
14
15
16
17
18
19
# File 'lib/stub/abstract.rb', line 11

def initialize object
	@object     = object
	@stub_class = self.class

	singleton_class = self.singleton_class

	methods.each &singleton_class.method(:undef_method)
	singleton_class.send :include, @stub_class.const_get(:Methods)
end

Class Method Details

.inherited(subclass) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/stub/abstract.rb', line 3

def self.inherited subclass
	eval <<-RUBY
		module #{subclass}::Methods
			include #{self}::Methods
		end
	RUBY
end