Class: Baan::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/baan/cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parser: Parser.new) ⇒ Cache

Returns a new instance of Cache.



5
6
7
# File 'lib/baan/cache.rb', line 5

def initialize(parser: Parser.new)
  @parser = parser
end

Instance Attribute Details

#parserObject (readonly)

Returns the value of attribute parser.



3
4
5
# File 'lib/baan/cache.rb', line 3

def parser
  @parser
end

Instance Method Details

#dataObject



9
10
11
12
13
14
15
# File 'lib/baan/cache.rb', line 9

def data
  @data ||= begin
    dataset.each_with_object(Hash.new { |h, k| h[k] = {} }) do |(key, dataset), result|
      dataset.each { result[key][it.code] = it }
    end
  end
end