Module: TogetherHelper

Included in:
Array
Defined in:
lib/open_classes/array/together_helper.rb

Overview

TogetherHelper

Instance Method Summary collapse

Instance Method Details

#get_args_for_together(i) ⇒ Object



11
12
13
14
15
# File 'lib/open_classes/array/together_helper.rb', line 11

def get_args_for_together(i)
  eval_each = []
  each_with_index { |j_v, j|eval_each << "self[#{j}][#{i}]" }
  eval_each
end

#get_args_str_for_together(i, with_index = false) ⇒ Object



17
18
19
20
# File 'lib/open_classes/array/together_helper.rb', line 17

def get_args_str_for_together(i, with_index = false)
  each_eval = with_index ? get_args_for_together(i) << i : get_args_for_together(i)
  each_eval.join(',')
end

#if_not_contain_array_rails_type_errorObject



7
8
9
# File 'lib/open_classes/array/together_helper.rb', line 7

def if_not_contain_array_rails_type_error
  each { |f|fail TypeError, "you have to use [Array1, Array2, ...] | #{f.class} is invalid" unless f.class == Array }
end

#together_return_multi?(list) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/open_classes/array/together_helper.rb', line 22

def together_return_multi?(list)
  (list.class == Array && list.size == size).to_bool
end