SafeOstruct is a fast, dependency-free struct-like class with an OpenStruct-style interface. Instances are built on cached per-key-set shape classes with real attr_accessor methods, so attribute reads and writes run at Struct speed (within ~10% of raw Hash access) instead of going through method_missing. It supports dynamic attributes, method-style and hash-style (symbol or string) access, and returns nil instead of raising NoMethodError for undefined attributes.

Required Ruby Version

>= 3.0

Authors

Waqas Ali

Versions

  1. 2.0.0
    1. source

      1. 2.0.0 source July 27, 2026 (11 KB)
  2. 1.0.0
    1. source

      1. 1.0.0 source July 27, 2026 (8.5 KB)

Pushed by

SHA 256 checksum