rb_struct_each_pair

T

Tim Hunter

Kevin said:
Hi, I'm toying with ruby 1.8.2 C extensions and am trying to use
rb_struct_each_pair:

http://www.eng.cse.dmu.ac.uk/~hgs/ruby/rubycvsdocs/classes/Struct.html#M001234

but am getting an "undeclared identifier" error. Is this function not
included in 1.8.2?

It's not defined in any version of Ruby that I have available (1.6.7, 1.6.8,
1.8.1, 1.8.2 preview1).

Is it possible you want rb_struct_each instead?

/*
* call-seq:
* struct.each {|obj| block } => struct
*
* Calls <i>block</i> once for each instance variable, passing the
* value as a parameter.
*
* Customer = Struct.new:)name, :address, :zip)
* joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
* joe.each {|x| puts(x) }
*
* <em>produces:</em>
*
* Joe Smith
* 123 Maple, Anytown NC
* 12345
*/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,414
Latest member
GayleWedel

Latest Threads

Top