Class: USPSFlags::Helpers

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

Overview

Container class for helper methods.

Since:

  • 0.1.5

Class Method Summary collapse

Class Method Details

.valid_flags(type = :all) ⇒ Array

Valid options for flag generation.

Parameters:

  • type (Symbol) (defaults to: :all)

    Specify subset of flags.

Options Hash (type):

  • :all (Symbol)

    All flags

  • :officer (Symbol)

    Officer flags

  • :insignia (Symbol)

    Insignia-eligible officer flags (no past officers)

  • :squadron (Symbol)

    Squadron-level officer flags

  • :district (Symbol)

    District-level officer flags

  • :national (Symbol)

    National-level officer flags

  • :special (Symbol)

    Special flags

  • :us (Symbol)

    US flag

Returns:

  • (Array)

    Valid options for flag generation (based on the provided type).

Since:

  • 0.1.5



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/usps_flags/helpers.rb', line 15

def self.valid_flags(type = :all)
  squadron = %w[
    PLTC
    PC
    PORTCAP
    FLEETCAP
    LT
    FLT
    1LT
    LTC
    CDR
  ]

  district = %w[
    PDLTC
    PDC
    DLT
    DAIDE
    DFLT
    D1LT
    DLTC
    DC
  ]

  national = %w[
    PSTFC
    PRC
    PVC
    PCC
    NAIDE
    NFLT
    STFC
    RC
    VC
    CC
  ]

  past = %w[
    PLTC
    PC
    PDLTC
    PDC
    PSTFC
    PRC
    PVC
    PCC
  ]

  special = %w[
    CRUISE
    OIC
    ENSIGN
    WHEEL
  ]

  us = %w[
    US
  ]

  case type
  when :all
    squadron + district + national + special + us
  when :officer
    squadron + district + national
  when :insignia
    squadron + district + national - past
  when :squadron
    squadron
  when :district
    district
  when :national
    national
  when :special
    special
  when :us
    us
  end
end