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.131 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.130 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.129 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.128 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.127 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.126 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.125 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.124 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.123 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.122 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.121 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.120 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.119 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.118 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.117 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.116 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.115 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.114 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.113 lib/open_classes/array/together_helper.rb
tbpgr_utils-0.0.112 lib/open_classes/array/together_helper.rb