Class: Weblate::ActionEnum

Inherits:
Object
  • Object
show all
Defined in:
lib/weblate/models/action_enum.rb

Constant Summary collapse

N0 =
0.freeze
N1 =
1.freeze
N2 =
2.freeze
N5 =
5.freeze
N3 =
3.freeze
N4 =
4.freeze
N6 =
6.freeze
N7 =
7.freeze
N8 =
8.freeze
N9 =
9.freeze
N13 =
13.freeze
N14 =
14.freeze
N15 =
15.freeze
N17 =
17.freeze
N18 =
18.freeze
N19 =
19.freeze
N20 =
20.freeze
N21 =
21.freeze
N22 =
22.freeze
N23 =
23.freeze
N28 =
28.freeze
N24 =
24.freeze
N25 =
25.freeze
N26 =
26.freeze
N27 =
27.freeze
N29 =
29.freeze
N30 =
30.freeze
N31 =
31.freeze
N32 =
32.freeze
N33 =
33.freeze
N34 =
34.freeze
N35 =
35.freeze
N36 =
36.freeze
N37 =
37.freeze
N38 =
38.freeze
N39 =
39.freeze
N41 =
41.freeze
N42 =
42.freeze
N43 =
43.freeze
N45 =
45.freeze
N46 =
46.freeze
N47 =
47.freeze
N48 =
48.freeze
N49 =
49.freeze
N50 =
50.freeze
N51 =
51.freeze
N52 =
52.freeze
N53 =
53.freeze
N54 =
54.freeze
N55 =
55.freeze
N56 =
56.freeze
N57 =
57.freeze
N58 =
58.freeze
N59 =
59.freeze
N60 =
60.freeze
N61 =
61.freeze
N62 =
62.freeze
N63 =
63.freeze
N64 =
64.freeze
N65 =
65.freeze
N66 =
66.freeze
N67 =
67.freeze
N68 =
68.freeze
N69 =
69.freeze
N70 =
70.freeze
N71 =
71.freeze
N72 =
72.freeze
N73 =
73.freeze
N74 =
74.freeze
N75 =
75.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_varsObject



89
90
91
# File 'lib/weblate/models/action_enum.rb', line 89

def self.all_vars
  @all_vars ||= [N0, N1, N2, N5, N3, N4, N6, N7, N8, N9, N13, N14, N15, N17, N18, N19, N20, N21, N22, N23, N28, N24, N25, N26, N27, N29, N30, N31, N32, N33, N34, N35, N36, N37, N38, N39, N41, N42, N43, N45, N46, N47, N48, N49, N50, N51, N52, N53, N54, N55, N56, N57, N58, N59, N60, N61, N62, N63, N64, N65, N66, N67, N68, N69, N70, N71, N72, N73, N74, N75].freeze
end

.build_from_hash(value) ⇒ String

Builds the enum from string

Parameters:

  • The (String)

    enum value in the form of the string

Returns:

  • (String)

    The enum value



96
97
98
# File 'lib/weblate/models/action_enum.rb', line 96

def self.build_from_hash(value)
  new.build_from_hash(value)
end

Instance Method Details

#build_from_hash(value) ⇒ String

Builds the enum from string

Parameters:

  • The (String)

    enum value in the form of the string

Returns:

  • (String)

    The enum value



103
104
105
106
# File 'lib/weblate/models/action_enum.rb', line 103

def build_from_hash(value)
  return value if ActionEnum.all_vars.include?(value)
  raise "Invalid ENUM value #{value} for class #ActionEnum"
end