Sha256: 311f8d12cc393f0ec6a14302b28ea1f44b70d188003c82eb355e64a4ce2211f6

Contents?: true

Size: 530 Bytes

Versions: 87

Compression:

Stored size: 530 Bytes

Contents

# encoding: utf-8

module EvalHelper
  # create each brace single line code, for eval
  #
  # ==== Examples
  #
  #   class EvalHelperEachBraceTest
  #     include EvalHelper
  #
  #     def hoge(hash)
  #       each_brace_code(hash[:target], hash[:proc])
  #     end
  #   end
  #
  #   hash = {
  #     target: '[:a, :b]',
  #     proc: 'puts v',
  #   }
  #   EvalHelperEachBraceTest.new.hoge(hash) # => return '[:a, :b].each { |v|puts v }'
  #
  def each_brace_code(target, proc)
    "#{target}.each { |v|#{proc} }"
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.151 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.150 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.149 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.148 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.147 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.146 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.145 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.144 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.143 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.142 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.141 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.140 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.139 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.138 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.137 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.136 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.135 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.134 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.133 lib/eval_helper/each_brace_code.rb
tbpgr_utils-0.0.132 lib/eval_helper/each_brace_code.rb