Sha256: 222f1a7c9bbbcc7d9d98336d315a5ed5a2e08db7c0872d7710d7fa0d1a91728d
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require 'ixtlan/babel/context' module Ixtlan module Babel class FilterConfig private def context @context ||= {} end def context_options( context_or_options ) if context_or_options case context_or_options when Symbol if opts = context[ context_or_options ] opts.dup end when Hash context_or_options end end end public def default_context_key( single = :single, collection = :collection ) @single, @collection = single, collection end def []=( key, options ) context[ key.to_sym ] = options if key end def []( key ) context[ key.to_sym ] if key end def single_options( context_or_options ) context_options( context_or_options ) || context[ default_context_key[ 0 ] ] || {} end def collection_options( context_or_options ) context_options( context_or_options ) || context[ default_context_key[ 1 ] ] || {} end attr_accessor :root end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ixtlan-babel-0.3.0 | lib/ixtlan/babel/filter_config.rb |
ixtlan-babel-0.2.1 | lib/ixtlan/babel/filter_config.rb |