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.151 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.150 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.149 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.148 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.147 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.146 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.145 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.144 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.143 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.142 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.141 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.140 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.139 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.138 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.137 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.136 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.135 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.134 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.133 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.132 lib/open_classes/array/together_helper.rb