|
| 1 | +# Contributing to recursive-open-struct |
| 2 | + |
| 3 | +Thanks for wanting to contribute a bug or code to recursive-open-struct! |
| 4 | + |
| 5 | +To help you out with understanding the direction and philosophy of this project |
| 6 | +with regards to to new features/how it should behave (and whether to file a bug |
| 7 | +report), please review the following contribution guidelines. |
| 8 | + |
| 9 | +## ROS Feature Philosophy |
| 10 | + |
| 11 | +Recursive-open-struct tries to be a minimal extension to the Ruby stdlib's |
| 12 | +`ostruct`/OpenStruct that allows for a nested set of Hashes (and Arrays) to |
| 13 | +initialize similarly structured OpenStruct-like objects. This has the benefit |
| 14 | +of creating arbitrary objects whose values can be accessed with accessor |
| 15 | +methods, similar to JavaScript Objects' dot-notation. |
| 16 | + |
| 17 | +To phrase it another way, RecursiveOpenStruct tries to behave as closely as |
| 18 | +possible to OpenStruct, except for the recursive functionality that it adds. |
| 19 | + |
| 20 | +If Recursive-open-struct were to add additional features (particularly methods) |
| 21 | +that are not implemented by OpenStruct, then those method names would not be |
| 22 | +available for use for accessing fields with the dot-notation that OpenStruct |
| 23 | +and RecursiveOpenStruct provide. |
| 24 | + |
| 25 | +For example, OpenStruct is not (at the time this is written) a |
| 26 | +subclass/specialization of Hash, so several methods implemented by Hash do not |
| 27 | +work with OpenStruct (and thus Recursive OpenStruct), such as `#fetch`. |
| 28 | + |
| 29 | +If you want to add features into RecursiveOpenStruct that would "pollute" the |
| 30 | +method namespace more than OpenStruct already does, consider creating your own |
| 31 | +subclass instead of submitting a code change to RecursiveOpenStruct itself. |
| 32 | + |
| 33 | + |
| 34 | +## Filing/Fixing Bugs and Requesting/Proposing New Features |
| 35 | + |
| 36 | +For simple bug fixes, feel free to provide a pull request. This includes bugs |
| 37 | +in stated features of RecursiveOpenStruct, as well as features added to |
| 38 | +OpenStruct in a newer version of Ruby that RecursiveOpenStruct needs custom |
| 39 | +support to handle. |
| 40 | + |
| 41 | +For anything else (new features, bugs that you want to report, and bugs that |
| 42 | +are difficult to fix), I recommend opening an issue first to discuss the |
| 43 | +feature or bug. I am fairly cautious about adding new features that might cause |
| 44 | +RecursiveOpenStruct's API to deviate radically from OpenStruct's (since it |
| 45 | +might introduce new reserved method names), and it is useful to discuss the |
| 46 | +best way to solve a problem when there are tradeoffs or imperfect solutions. |
| 47 | + |
| 48 | +When contributing code that changes behavior or fixes bugs, please include unit |
| 49 | +tests to cover the new behavior or to provide regression testing for bugs. |
| 50 | +Also, treat the unit tests as documentation --- make sure they are clean, |
| 51 | +clear, and concise, and well organized. |
0 commit comments