ruby - Creating a reach definition -


My access definition is to check an array to see if it's every member in the array If not, they seem to be different, so each can be applied, it just seems to print the array ... it is actually using Ruby for the first time, so I need some help. My code is:

  remove square string The last class object df tests # on each response and if it prints it then returns to # object if it receives (x.respond_to? (: Each)) self.each { | X | Print x, "\ n"} and yield (self) self.each {| X | Print X, "\ n"} End and # Test (Delete before submitting) [4, 13, 18, "Fred", "Alice"] Each {| X | Print X, "\ n"} [4, 13, 18, "Fred", "Alice"]. Access {| X | Print x, "\ n"} [4, [13, 88], [19, "frad", "snark"], "alice"] Each {| X | Print x, "\ n"} [4, [13, 88], [19, "Fred", "snark"], "Alice"] {{X | X |   

I think my part is right, but my share if it is with which I am struggling ... I have written that answer what "each" And if it applies every element to each side every time, I've written the code to check it .. and earn yourself and then apply every element of every array ...

If I understand you correctly, you can Want to call every (or reaching , anyway) that supports every element? Try to do something like this:

  Access the module enraptable diff and block each e. Block.call (E) if E. Paes_to? (: Each) e.each (& amp; block) # or, perhaps, E.reach? End end end    

Comments