Class: Growatt::Enum

Inherits:
Object
  • Object
show all
Defined in:
lib/growatt/const.rb

Overview

A base class for defining enumerations using constants.

This class dynamically defines constants from an array of strings.

Class Method Summary collapse

Class Method Details

.enum(array) ⇒ Object

Defines constants based on the provided array.

Parameters:

  • array (Array<String>)

    The array of strings to be converted into constants.



11
12
13
14
15
# File 'lib/growatt/const.rb', line 11

def self.enum(array)
  array.each do |c|
    const_set c, c
  end
end