Method: Mappable::Map#cached_mappings

Defined in:
app/models/mappable/map.rb

#cached_mappingsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/models/mappable/map.rb', line 9

def cached_mappings
  @cache ||= begin
    self.mappings.inject({}) do |cache, m|
      cache[:to] ||= {}
      cache[:to][m.to.downcase] = m.from

      cache[:from] ||= {}
      cache[:from][m.from.downcase] = m.to
      
      cache
    end
  end
end