Class: Shiftable::Shifting

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

Overview

Gets data to be shifted

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bangObject

Public API



7
8
9
# File 'lib/shiftable/shifting.rb', line 7

def bang
  @bang
end

#baseObject (readonly)

Internal API



10
11
12
# File 'lib/shiftable/shifting.rb', line 10

def base
  @base
end

#columnObject (readonly)

Internal API



10
11
12
# File 'lib/shiftable/shifting.rb', line 10

def column
  @column
end

#fromObject (readonly)

Returns the value of attribute from.



8
9
10
# File 'lib/shiftable/shifting.rb', line 8

def from
  @from
end

#resultObject

Public API



7
8
9
# File 'lib/shiftable/shifting.rb', line 7

def result
  @result
end

#run_saveObject (readonly)

Internal API



10
11
12
# File 'lib/shiftable/shifting.rb', line 10

def run_save
  @run_save
end

#shift_all_wrapperObject

Public API



7
8
9
# File 'lib/shiftable/shifting.rb', line 7

def shift_all_wrapper
  @shift_all_wrapper
end

#shift_each_wrapperObject

Public API



7
8
9
# File 'lib/shiftable/shifting.rb', line 7

def shift_each_wrapper
  @shift_each_wrapper
end

#toObject (readonly)

Returns the value of attribute to.



8
9
10
# File 'lib/shiftable/shifting.rb', line 8

def to
  @to
end