Class: Surrogate::Endower

Inherits:
Object
  • Object
show all
Defined in:
lib/surrogate/endower.rb

Overview

adds surrogate behaviour to your class / singleton class / instances

please refactor me!

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, &playlist) ⇒ Endower

Returns a new instance of Endower.



13
14
15
# File 'lib/surrogate/endower.rb', line 13

def initialize(klass, &playlist)
  self.klass, self.playlist = klass, playlist
end

Instance Attribute Details

#klassObject

Returns the value of attribute klass.



11
12
13
# File 'lib/surrogate/endower.rb', line 11

def klass
  @klass
end

#playlistObject

Returns the value of attribute playlist.



11
12
13
# File 'lib/surrogate/endower.rb', line 11

def playlist
  @playlist
end

Class Method Details

.endow(klass, &playlist) ⇒ Object



7
8
9
# File 'lib/surrogate/endower.rb', line 7

def self.endow(klass, &playlist)
  new(klass, &playlist).endow
end

Instance Method Details

#endowObject



17
18
19
20
# File 'lib/surrogate/endower.rb', line 17

def endow
  endow_klass
  endow_singleton_class
end