Sha256: ccec327bbfabfe8d7710d0e92933aefa8aa9b65b8deedf0c73c5e5795efe4d3a

Contents?: true

Size: 404 Bytes

Versions: 2

Compression:

Stored size: 404 Bytes

Contents

# frozen_string_literal: true

module Yext
  module Api
    module Concerns
      # This concern adds an `all` method to an enumeration class to list all constants in that class.
      module EnumAll
        extend ActiveSupport::Concern

        class_methods do
          def all
            (constants - %i[ClassMethods]).map { |c| const_get(c) }
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yext-api-0.1.3 lib/yext/api/concerns/enum_all.rb
yext-api-0.1.1 lib/yext/api/concerns/enum_all.rb