Sha256: 43790982d03395bd3e367bbf05a147b25cfdbc5220352457fee84943b307945a
Contents?: true
Size: 1.48 KB
Versions: 3
Compression:
Stored size: 1.48 KB
Contents
module ESA module Config mattr_accessor :processor self.processor = ESA::BlockingProcessor mattr_accessor :context_checkers self.context_checkers = Set.new self.context_checkers << ESA::BalanceChecker self.context_checkers << ESA::SubcontextChecker mattr_accessor :context_providers self.context_providers = { 'account' => ESA::ContextProviders::AccountContextProvider, 'accountable' => ESA::ContextProviders::AccountableContextProvider, 'accountable_type' => ESA::ContextProviders::AccountableTypeContextProvider, 'monthly' => [ESA::ContextProviders::DateContextProvider, {period: :month}], 'daily' => [ESA::ContextProviders::DateContextProvider, {period: :day}], } mattr_accessor :context_tree self.context_tree = { 'account' => { 'monthly' => { 'daily' => {}, }, }, 'monthly' => { 'account' => { 'daily' => {}, }, }, 'daily' => { 'account' => {}, }, } def self.walk_context_tree(path=[], tree=self.context_tree) if path.respond_to? :count and path.count == 0 tree || {} elsif path.respond_to? :first and tree.is_a? Hash and path.first.in? tree walk_context_tree(path.drop(1), tree[path.first]) else {} end end def self.context_providers_for_path(path=[]) context_providers.slice(*walk_context_tree(path).keys) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
event_sourced_accounting-0.1.4 | lib/esa/config.rb |
event_sourced_accounting-0.1.3 | lib/esa/config.rb |
event_sourced_accounting-0.1.1 | lib/esa/config.rb |