Thursday, June 04, 2026 2:33:14 AM
> project show esm_website_v1
The unexpected heart of the ESM ecosystem. What started as a simple Rails dashboard has evolved into the command center for thousands of gaming communities, proving that sometimes the best infrastructure projects are the ones you never planned to build.
Details
> public_attributes.rb
# frozen_string_literal: true

module PublicAttributes
  extend ActiveSupport::Concern

  included do
    class_attribute :public_attributes_list, default: []
  end

  class_methods do
    def public_attributes(*attributes)
      self.public_attributes_list = attributes
    end
  end

  def public_attributes
    result = {}

    public_attributes_list.each do |attr|
      case attr
      when Symbol
        result[attr] = public_send(attr)
      when Hash
        attr.each do |key, proc|
          result[key] = proc.call(self)
        end
      end
    end

    result.with_indifferent_access
  end
end
All opinions represented herein are my own
- © 2024 - 2026 itsthedevman
- build 4294fb2