Class: FactPulse::NatureOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/factpulse/models/nature_operation.rb

Constant Summary collapse

B1 =
"B1".freeze
S1 =
"S1".freeze
M1 =
"M1".freeze
B2 =
"B2".freeze
S2 =
"S2".freeze
M2 =
"M2".freeze
B4 =
"B4".freeze
S4 =
"S4".freeze
M4 =
"M4".freeze
S3 =
"S3".freeze
S5 =
"S5".freeze
S6 =
"S6".freeze
B7 =
"B7".freeze
S7 =
"S7".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_varsObject



33
34
35
# File 'lib/factpulse/models/nature_operation.rb', line 33

def self.all_vars
  @all_vars ||= [B1, S1, M1, B2, S2, M2, B4, S4, M4, S3, S5, S6, B7, S7].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



40
41
42
# File 'lib/factpulse/models/nature_operation.rb', line 40

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



47
48
49
50
# File 'lib/factpulse/models/nature_operation.rb', line 47

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