If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Not Flowstone related - Ruby code question
11 posts
• Page 2 of 2 • 1, 2
Re: Not Flowstone related - Ruby code question
trogluddite wrote:TheOm wrote:I haven't found any actual use of __add_one_arg_setter in the code though, just an undef, so not sure why they need it.
The method is used within the C-extension which wraps the Cairo library (required as "cairo.so" in the Ruby code, and defined in the "ext/cairo" sub-folder of the Git repo). Since C++ code can't use "=" in member-function names, the "set_..." naming convention is used internally, and then the method in question is called to convert these into Ruby attr_writers when the extension is 'required'. Once the extension is loaded, the conversion method isn't needed any more and is undefined.
So the method does serve a useful purpose; though I agree with tulamide that it's coded in a pretty clumsy way - and there's even part of it that does nothing useful at all (presumably a silly oversight)...
- Code: Select all
include? "#{$1}="
This will always be false, as the Array of method names will contain Symbols, not Strings!
PS) The use of the C-extension implies that some Visual Studio C++ compilation would be required to get the library working in FlowStone.
trog, thank you very much for explaining the background, which is important! You are right that it makes sense, as you explain it. Unfortunately this brings up another question: Does this code read C-functions and replaces setters with Ruby code? You see, I seem to have not quite figured it out yet.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
11 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 44 guests