Class: USPSFlags::Helpers::ValidFlags

Inherits:
Object
  • Object
show all
Defined in:
lib/usps_flags/helpers/valid_flags.rb

Class Method Summary collapse

Class Method Details

.bridge_flagsObject



45
46
47
48
# File 'lib/usps_flags/helpers/valid_flags.rb', line 45

def bridge_flags
  @squadron_elected.last(2) + @district_elected.last(2) + @national_elected.last(2) +
    @squadron_past.last(2) + @district_past.last(2) + @national_past.last(2)
end

.command_flagsObject



50
51
52
53
54
55
# File 'lib/usps_flags/helpers/valid_flags.rb', line 50

def command_flags
  [
    @squadron_elected.last, @district_elected.last, @national_elected.last,
    @squadron_past.last, @district_past.last, @national_past.last
  ]
end

.load_special_flagsObject



23
24
25
26
# File 'lib/usps_flags/helpers/valid_flags.rb', line 23

def load_special_flags
  @special = %w[CRUISE OIC ENSIGN] # WHEEL
  @us = %w[US]
end

.load_valid_flag_groupsObject



28
29
30
31
32
33
34
# File 'lib/usps_flags/helpers/valid_flags.rb', line 28

def load_valid_flag_groups
  @past = @squadron_past + @district_past + @national_past
  @squadron = @squadron_past + @squadron_elected + @squadron_swallowtail
  @district = @district_past + @district_elected + @district_swallowtail
  @national = @national_past + @national_elected + @national_swallowtail
  @officer = @squadron + @district + @national
end

.load_valid_flagsObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/usps_flags/helpers/valid_flags.rb', line 11

def load_valid_flags
  @squadron_past = %w[PLTC PC]
  @squadron_elected = %w[1LT LTC CDR]
  @squadron_swallowtail = %w[PORTCAP FLEETCAP LT FLT]
  @district_past = %w[PDLTC PDC]
  @district_elected = %w[D1LT DLTC DC]
  @district_swallowtail = %w[DLT DAIDE DFLT]
  @national_past = %w[PNFLT PSTFC PRC PVC PCC]
  @national_elected = %w[STFC RC VC CC]
  @national_swallowtail = %w[NAIDE NFLT]
end

.valid_flags_for(type) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/usps_flags/helpers/valid_flags.rb', line 36

def valid_flags_for(type)
  {
    special: @special, us: @us, bridge: bridge_flags, command: command_flags,
    squadron: @squadron, district: @district, national: @national, past: @past,
    all: @officer + @special + @us, officer: @officer, insignia: @officer - @past,
    swallowtail: @past + @squadron_swallowtail + @district_swallowtail + @national_swallowtail
  }[type]
end