Class: DmtdVbmappData::Protocol
- Inherits:
-
Object
- Object
- DmtdVbmappData::Protocol
- Defined in:
- lib/dmtd_vbmapp_data/protocol.rb
Overview
Provides for the retrieving the Protocol content from the VB-MAPP Data Server.
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#areas ⇒ Array<ProtocolArea>
The entire set of ProtocolArea instances.
-
#initialize(opts) ⇒ Protocol
constructor
Creates an accessor for the VB-MAPP content on the VB-MAPP Data Server.
Constructor Details
#initialize(opts) ⇒ Protocol
This method does not block, simply creates an accessor and returns
Creates an accessor for the VB-MAPP content on the VB-MAPP Data Server
15 16 17 |
# File 'lib/dmtd_vbmapp_data/protocol.rb', line 15 def initialize(opts) @client = opts.fetch(:client) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/dmtd_vbmapp_data/protocol.rb', line 8 def client @client end |
Instance Method Details
#areas ⇒ Array<ProtocolArea>
The first call to this method with an expired cache will block until the cache is populated. All subsequent calls will load from the cache.
The cache is an in-memory cache (not on-disc). Thus, if the process is restarted, the cache will be dropped. Additionally this cache expires once a day at midnight UTC.
Returns The entire set of DmtdVbmappData::ProtocolArea instances.
27 28 29 30 31 32 33 34 35 |
# File 'lib/dmtd_vbmapp_data/protocol.rb', line 27 def areas index_array = index @areas = index_array.map do |area_index_json| ProtocolArea.new(client: client, area_index_json: area_index_json) end if @areas.nil? && index_array.is_a?(Array) @areas end |