Module: Arturo::FeatureCaching::PrependMethods

Defined in:
lib/arturo/feature_caching.rb

Instance Method Summary collapse

Instance Method Details

#to_feature(feature_or_symbol) ⇒ Object

Wraps Arturo::Feature.to_feature with in-memory caching.


24
25
26
27
28
29
30
31
32
33
# File 'lib/arturo/feature_caching.rb', line 24

def to_feature(feature_or_symbol)
  if !caches_features?
    super
  elsif feature_or_symbol.kind_of?(Arturo::Feature)
    feature_or_symbol
  else
    symbol = feature_or_symbol.to_sym
    feature_caching_strategy.fetch(feature_cache, symbol) { super(symbol) }
  end
end