Sha256: 792b163fabbef1b6d06b0c5311d71041536405dfb10b7b8643671a2e26a61f5a
Contents?: true
Size: 676 Bytes
Versions: 2
Compression:
Stored size: 676 Bytes
Contents
require 'yaml' require 'pathname' module RBatch module_function # Read config file and return hash opject. # # Default config file path is "../config/(Program name).yaml" # ==== Sample # config : ./config/sample2.yaml # key: value # array: # - item1 # - item2 # - item3 # script : ./bin/sample2.rb # require 'rbatch' # p RBatch::config # => {"key" => "value", "array" => ["item1", "item2", "item3"]} def config file = Pathname(File.basename(RBatch.program_name)).sub_ext(".yaml").to_s dir = File.join(File.join(File.dirname(RBatch.program_name),".."),"config") return YAML::load_file(File.join(dir,file)) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rbatch-1.4.3 | lib/rbatch/config.rb |
rbatch-1.4.0 | lib/rbatch/config.rb |