Class: Racf::Pagers::CachedIspfPager

Inherits:
Object
  • Object
show all
Defined in:
lib/racf/pagers/cached_ispf_pager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, uncached_pager = IspfPager) ⇒ CachedIspfPager

Returns a new instance of CachedIspfPager.



8
9
10
11
12
# File 'lib/racf/pagers/cached_ispf_pager.rb', line 8

def initialize(command, uncached_pager=IspfPager)
  @command = command
  @pager   = uncached_pager.new @command
  @cache   = Hash.new { |hash, key| hash[key] = {} }
end

Instance Attribute Details

#cacheObject

Returns the value of attribute cache.



6
7
8
# File 'lib/racf/pagers/cached_ispf_pager.rb', line 6

def cache
  @cache
end

Instance Method Details

#run(*arguments) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/racf/pagers/cached_ispf_pager.rb', line 14

def run(*arguments)
  resources = @command.extract_resources(arguments)

  if resources.empty?
    @pager.run(*arguments)
  else
    run_cached(arguments, resources)
  end
end