Class: Shapeshifter::Shifter
- Inherits:
-
Object
- Object
- Shapeshifter::Shifter
- Defined in:
- lib/shapeshifter/shifter.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#source_object ⇒ Object
readonly
Returns the value of attribute source_object.
Class Method Summary collapse
- .chain(shifter) ⇒ Object
- .revert(source_object, target_object) ⇒ Object
- .shift(source_object, target_object) ⇒ Object
Instance Method Summary collapse
-
#initialize(source_object) ⇒ Shifter
constructor
A new instance of Shifter.
- #revert(_) ⇒ Object
- #shift(_) ⇒ Object
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_object ⇒ Object (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
27 28 29 |
# File 'lib/shapeshifter/shifter.rb', line 27 def revert(_) raise NoMethodError.new('Should be overridden') end |
#shift(_) ⇒ Object
23 24 25 |
# File 'lib/shapeshifter/shifter.rb', line 23 def shift(_) raise NoMethodError.new('Should be overridden') end |