Class: DmtdVbmappData::ProtocolArea

Inherits:
Object
  • Object
show all
Defined in:
lib/dmtd_vbmapp_data/protocol_area.rb

Overview

Provides for the retrieving of VB-MAPP Protocol Area information from the VB-MAPP Data Server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ ProtocolArea

Note:

This method does not block, simply creates an accessor and returns

Creates an accessor for the VB-MAPP Guide Chapter on the VB-MAPP Data Server

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):



23
24
25
26
27
28
29
# File 'lib/dmtd_vbmapp_data/protocol_area.rb', line 23

def initialize(opts)
  @client = opts.fetch(:client)

  index_json = opts.fetch(:area_index_json)
  @area = index_json[:area].to_sym
  @groups_index = index_json[:groups]
end

Instance Attribute Details

#areaObject (readonly)

Returns the value of attribute area.



14
15
16
# File 'lib/dmtd_vbmapp_data/protocol_area.rb', line 14

def area
  @area
end

#clientObject (readonly)

Returns the value of attribute client.



10
11
12
# File 'lib/dmtd_vbmapp_data/protocol_area.rb', line 10

def client
  @client
end

Instance Method Details

#groupsArray<ProtocolAreaGroup>

Note:

This method does not block on server access

Returns all of the VB-Mapp’s DmtdVbmappData::ProtocolAreaGroup instances.

Returns:



34
35
36
37
38
39
40
# File 'lib/dmtd_vbmapp_data/protocol_area.rb', line 34

def groups
  @groups = @groups_index.map.with_index do |group_index_json, group_num|
    ProtocolAreaGroup.new(client: client, area: area, group_index_json: group_index_json)
  end if @groups.nil?

  @groups
end