Class: Shiftable::ShiftingRecord

Inherits:
Shifting
  • Object
show all
Defined in:
lib/shiftable/shifting_record.rb

Overview

Gets data to be shifted

Instance Attribute Summary

Attributes inherited from Shifting

#bang, #base, #column, #from, #result, #run_save, #shift_all_wrapper, #shift_each_wrapper, #to

Instance Method Summary collapse

Methods inherited from Shifting

#initialize

Constructor Details

This class inherits a constructor from Shiftable::Shifting

Instance Method Details

#found?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/shiftable/shifting_record.rb', line 6

def found?
  !!result
end

#shiftObject

Returns true, false.

Returns:

  • true, false



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

def shift
  return false unless found?

  result.send("#{column}=", to.id)
  @run_save = yield if block_given?
  return nil unless run_save

  run_save!
end