Class: Shapeshifter::Shifter

Inherits:
Object
  • Object
show all
Defined in:
lib/shapeshifter/shifter.rb

Direct Known Subclasses

NullShifter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_object) ⇒ Shifter

Returns a new instance of Shifter.



5
6
7
# File 'lib/shapeshifter/shifter.rb', line 5

def initialize(source_object)
  @source_object = source_object
end

Instance Attribute Details

#source_objectObject (readonly)

Returns the value of attribute source_object.



3
4
5
# File 'lib/shapeshifter/shifter.rb', line 3

def source_object
  @source_object
end

Class Method Details

.chain(shifter) ⇒ Object



10
11
12
# File 'lib/shapeshifter/shifter.rb', line 10

def chain(shifter)
  ShiftChain.new(self).chain(shifter)
end

.revert(source_object, target_object) ⇒ Object



18
19
20
# File 'lib/shapeshifter/shifter.rb', line 18

def revert(source_object, target_object)
  ShiftChain.new(self).revert(source_object, target_object)
end

.shift(source_object, target_object) ⇒ Object



14
15
16
# File 'lib/shapeshifter/shifter.rb', line 14

def shift(source_object, target_object)
  ShiftChain.new(self).shift(source_object, target_object)
end

Instance Method Details

#revert(_) ⇒ Object

Raises:

  • (NoMethodError)


27
28
29
# File 'lib/shapeshifter/shifter.rb', line 27

def revert(_)
  raise NoMethodError.new('Should be overridden')
end

#shift(_) ⇒ Object

Raises:

  • (NoMethodError)


23
24
25
# File 'lib/shapeshifter/shifter.rb', line 23

def shift(_)
  raise NoMethodError.new('Should be overridden')
end