From the link I found the two methods :
pretty_print (Struct) - APIdock
Struct#pretty_print_cycle and Struct#pretty_print.
Could anyone give me two examples to understand the differences between
them? As I didn’t found any documentation.
Thanks
From the link I found the two methods :
pretty_print (Struct) - APIdock
Struct#pretty_print_cycle and Struct#pretty_print.
Could anyone give me two examples to understand the differences between
them? As I didn’t found any documentation.
Thanks
i found this in the code
Object#pretty_print_cycle is used when +obj+ is already
# printed, a.k.a the object reference chain has a cycle.
Hans M. wrote in post #1098243:
i found this in the code
Object#pretty_print_cycle is used when +obj+ is already
# printed, a.k.a the object reference chain has a cycle.
@Hans Could you give me an example of those to understand the
differences?
Thanks
what the heck is the problem with “already printed” ??
require “pp”
class A
attr_accessor :data
end
o=A.new
o.data = o
pp o # => #<A:0x00000001e0e178 @data=#<A:0x00000001e0e178 …>>
a = []
a << a
pp a #=> [[…]]
h = {}
h[h]=h
pp h #=> {{…}=>{…}}
pretty_print_cycle is for making the … variants
Hey “Love U Ruby”,
Are you still trying to find “weaknesses”?
The official documentation is at:
Quit using non standard sources already.
I am 100% sure you never had a real need for any of this,
you are just scavenging for percieved “weaknesses”, then
you steal the time of other people here!
(See his other comments/threads.)
On Feb 21, 2013, at 11:36 , Marc H. [email protected] wrote:
Hey “Love U Ruby”,
Are you still trying to find “weaknesses”?
The official documentation is at:
Quit using non standard sources already.
To be fair… that’s not “standard” any more than apidock is. De facto,
yes… but not standard.
On Thu, Feb 21, 2013 at 1:36 PM, Marc H. [email protected]
wrote:
I am 100% sure you never had a real need for any of this,
you are just scavenging for percieved “weaknesses”, then
you steal the time of other people here!(See his other comments/threads.)
–
Posted via http://www.ruby-forum.com/.
I am also not sure of the sincerity of the OP simply as the questions
are open ended without example of either working, or not working,
code. Also ending each thread with “show me some examples” doesn’t
help either. Though I would love to explore the concept of text
processing with high level print formatters while exploring their uses
in the real world via polymorphic view with modular abstraction while
pointing out primitive functions such as inspect and it’s relationship
to the c puts function as a simple wrapper to printf while exploring
aliasing with shortform such as p and the Kernel modules extension
syntax to the systems standard in/out and error. But that would
require a bit of effort for an open ended and obtuse question without
a specific issue or use case attached.
With that said “Love U Ruby” may I recommend reading this tutorial on
communication with technical forums with questions pertaining to
learning new programming languages, dialects with programming
environments and conceptual frameworks without the anti-pattern of
insulting members of the community by either being misinformed now
explaining the issues which your currently having with your project or
motivation to be working the the technology at hand. This venerable
tutorial is located here:
http://www.catb.org/esr/faqs/smart-questions.html
~Stu
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs