Sha256: ff4bad39e011f64f1ab0ac3a75f939d8bd31dd4c032233f87d6d6a4a2e47efea
Contents?: true
Size: 978 Bytes
Versions: 1
Compression:
Stored size: 978 Bytes
Contents
# encoding: utf-8 module EvalHelper # create require_relative strings, for eval # # ==== Examples # # single require_relative case # # class EvalHelperRequireRelativeTest # include EvalHelper # # def hoge(*args) # require_relative_code(args) # end # end # # args = 'tbpgr_utils' # EvalHelperRequireRelativeTest.new.hoge(args) # => return "require_relative 'tbpgr_utils'\n" # # muiti require_relative case # # class EvalHelperRequireRelativeTest # include EvalHelper # # def hoge(*args) # require_relative_code(args) # end # end # # args = ['tbpgr_utils', 'eval_helper'] # EvalHelperRequireRelativeTest.new.hoge(args) # => return "require_relative 'tbpgr_utils'\nrequire_relative 'eval_helper'\n" # def require_relative_code(*args) args = args.is_a?(Array) ? args.flatten : [args] args.reduce([]) { |a, e|a << "require_relative '#{e}'\n" }.join end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tbpgr_utils-0.0.151 | lib/eval_helper/require_relative_code.rb |