Sha256: ec332d8bafae0f6370ea02e23f06e76fa4fe00358757bc061326672fdb4abb35
Contents?: true
Size: 980 Bytes
Versions: 2
Compression:
Stored size: 980 Bytes
Contents
require 'fluent/data_reader' module Fluent module DataBuilder extend DataReader class << self attr_accessor :data_source end def self.default_data_path 'common/data' end def data_for(key, specified={}) if key.is_a?(String) && key.match(%r{/}) file, record = key.split('/') DataBuilder.load("#{file}.yml") else record = key.to_s DataBuilder.load('default.yml') #unless DataBuilder.data_source end Fluent::trace("DataBuilder.data_source = #{DataBuilder.data_source}") data = DataBuilder.data_source[record] raise ArgumentError, "Undefined key for data: #{key}" unless data data.merge(specified) end alias_method :data_from, :data_for alias_method :data_about, :data_for alias_method :using_data_for, :data_for alias_method :using_data_from, :data_for end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fluent-0.7.0 | lib/fluent/data_builder.rb |
fluent-0.6.0 | lib/fluent/data_builder.rb |