Sha256: 3fe01917788304e571700ae9570eaf0820b5bd46823548bfa250f43f4bdbe196

Contents?: true

Size: 696 Bytes

Versions: 115

Compression:

Stored size: 696 Bytes

Contents

# encoding: utf-8
require 'open_classes/object'
require 'open_classes/module'

# TogetherHelper
module TogetherHelper
  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

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

  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

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

Version data entries

115 entries across 115 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.71 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.70 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.69 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.68 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.67 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.66 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.65 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.64 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.63 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.62 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.61 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.60 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.59 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.58 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.57 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.56 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.55 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.54 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.53 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.52 lib/open_classes/array/together_helper.rb