Pure Struct
Pure Struct is archived because it is no longer needed given that Opal fixed the implementation of Struct, and other Rubies like JRuby have a correct implementation of Struct already.
Pure Ruby re-implementation of Struct to ensure cross-Ruby functionality where needed (e.g. Opal)
It is useful when:
- There is a need for a Struct class that works consistently across esoteric implementations of Ruby like Opal. This is useful when writing cross-Ruby apps like those of Glimmer relying on YASL (Yet Another Serialization Library) in Opal.
- There is a need to meta-program Struct's data
- There are no big performance requirements that demand native Struct
In all other cases, stick to native Ruby Struct instead since it's optimized for performance.
Usage Instructions
Pure Struct is archived because it is no longer needed given that Opal fixed the implementation of Struct, and other Rubies like JRuby have a correct implementation of Struct already.
Run:
gem install pure-struct
Or add to Gemfile:
gem 'pure-struct', '~> 1.0.2'
If you want to use in Opal only inside Rails, suffix with require: false
:
gem 'pure-struct', '~> 1.0.2', require: false
And, run:
bundle
Finally, require in Ruby code:
require 'pure-struct'
Note that it removes the native Struct
implementation first, aliasing as NativeStruct
should you still need it, and then redefining Struct
in pure Ruby.
Optionally, you may code block the require statement by a specific Ruby engine like Opal:
if RUBY_ENGINE == 'opal'
require 'pure-struct'
end
Contributing to pure-struct
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
- Fork the project.
- Start a feature/bugfix branch.
- Commit and push until you are happy with your contribution.
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Software Process
TODO
Change Log
Copyright
Copyright (c) 2021 Andy Maleh.