Class: Shiftable::Shifting
- Inherits:
-
Object
- Object
- Shiftable::Shifting
- Defined in:
- lib/shiftable/shifting.rb
Overview
Gets data to be shifted
Direct Known Subclasses
ShiftingPolymorphicRelation, ShiftingRecord, ShiftingRelation
Instance Attribute Summary collapse
-
#bang ⇒ Object
Public API.
-
#base ⇒ Object
readonly
Internal API.
-
#column ⇒ Object
readonly
Internal API.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#result ⇒ Object
Public API.
-
#run_save ⇒ Object
readonly
Internal API.
-
#shift_all_wrapper ⇒ Object
Public API.
-
#shift_each_wrapper ⇒ Object
Public API.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(to:, from:, column:, base:, wrapper:, bang:) ⇒ Shifting
constructor
A new instance of Shifting.
Constructor Details
#initialize(to:, from:, column:, base:, wrapper:, bang:) ⇒ Shifting
Returns a new instance of Shifting.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/shiftable/shifting.rb', line 12 def initialize(to:, from:, column:, base:, wrapper:, bang:) @to = to @from = from @column = column @base = base validate do_query = block_given? ? yield : true @result = do_query ? query : nil @run_save = true @shift_all_wrapper = wrapper[:all] @shift_each_wrapper = wrapper[:each] @bang = bang end |
Instance Attribute Details
#bang ⇒ Object
Public API
7 8 9 |
# File 'lib/shiftable/shifting.rb', line 7 def bang @bang end |
#base ⇒ Object (readonly)
Internal API
10 11 12 |
# File 'lib/shiftable/shifting.rb', line 10 def base @base end |
#column ⇒ Object (readonly)
Internal API
10 11 12 |
# File 'lib/shiftable/shifting.rb', line 10 def column @column end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
8 9 10 |
# File 'lib/shiftable/shifting.rb', line 8 def from @from end |
#result ⇒ Object
Public API
7 8 9 |
# File 'lib/shiftable/shifting.rb', line 7 def result @result end |
#run_save ⇒ Object (readonly)
Internal API
10 11 12 |
# File 'lib/shiftable/shifting.rb', line 10 def run_save @run_save end |
#shift_all_wrapper ⇒ Object
Public API
7 8 9 |
# File 'lib/shiftable/shifting.rb', line 7 def shift_all_wrapper @shift_all_wrapper end |
#shift_each_wrapper ⇒ Object
Public API
7 8 9 |
# File 'lib/shiftable/shifting.rb', line 7 def shift_each_wrapper @shift_each_wrapper end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
8 9 10 |
# File 'lib/shiftable/shifting.rb', line 8 def to @to end |