Sha256: 58e65d43122ad72ff56a6682562d84e98fc25adfc4a710ae6dd4c99176b7d0c4
Contents?: true
Size: 488 Bytes
Versions: 2
Compression:
Stored size: 488 Bytes
Contents
# A drop-in replacement for Struct which adds a more flexible initialize method class FlexStruct autoload :VERSION, "flex_struct/version" autoload :Frozen, "flex_struct/frozen" autoload :Initializer, "flex_struct/initializer" def self.new(*args, &block) Struct.new(*args) do module_eval(&block) if block # Insert our `initialize` method into the ancestors chain so it can be # overridden by `block` if necessary include Initializer end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
flex_struct-0.1.2 | lib/flex_struct.rb |
flex_struct-0.1.1 | lib/flex_struct.rb |