[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to capture PrettyPrint output to string?

List Recv

12/8/2005 2:54:00 AM

I'd like to capture the output of pp (PrettyPrint) as a string, as
opposed to putting it on stdout.

Something like:
dump = myvar.pp

dump.class # => String

(Using .pretty_print_inspect is not adequate, as it's not the same as
pp, has no newlines, etc.)

Thanks!

--
Posted via http://www.ruby-....


16 Answers

Ryan Leavengood

12/8/2005 3:04:00 AM

0

require 'pp'
require 'stringio'

def my_pp(*args)
old_out = $stdout
begin
s=StringIO.new
$stdout=s
pp(*args)
ensure
$stdout=old_out
end
s.string
end


Gavin Sinclair

12/8/2005 3:35:00 AM

0


List Recv wrote:
> I'd like to capture the output of pp (PrettyPrint) as a string, as
> opposed to putting it on stdout.
>
> Something like:
> dump = myvar.pp

http://extensions.rub... defines Object#pp_s which does what you
want. You can examine the implementation on the website.

The Facets/Core project may have something similar. Hopefully with a
nicer name!

This functionality is a screaming omission from the standard library!

Gavin

Ara.T.Howard

12/8/2005 3:42:00 AM

0

The gods have made us mad

12/17/2011 2:31:00 PM

0



"Claire" wrote in message
news:7b3a5251-2f77-4578-a2cf-a4fa1182a8be@f11g2000yql.googlegroups.com...

To be fair the Jews are the only people still in existence who come
from that land and have ever run it in iniquity<<


A Freudian slip, Claire? - or many a true word spoken by a typing error?

China Blue Veins

12/17/2011 5:21:00 PM

0

In article <7b3a5251-2f77-4578-a2cf-a4fa1182a8be@f11g2000yql.googlegroups.com>,
Claire <claireonusenet@googlemail.com> wrote:

> On Dec 15, 12:48?am, doug <doug.mor...@gmail.com> wrote:
> > On Dec 14, 12:23?pm, JohnR <repro...@hotmail.com> wrote:
> >
> > > On 14/12/2011 11:02, samson wrote:
> >
> > > >http://www.ahavat-israel.com/eretz/...
> >
> > > The zionist cult is all about land grabbing, theft and colonial
> > > expansion. It has no more of a legitimate claim to the land already
> > > stolen than to the land they desire to steal in the rest of the ME.
> > > Hardly surprising to see maps like these. It just exposes the cult for
> > > what it really is.
> >
> > No,no! ? God told them to rob the Palestinians of their
> > land, ?so it must be ok then, right? ? LOL
>
> To be fair the Jews are the only people still in existence who come
> from that land and have ever run it in iniquity. And yes, I am sure
> God has something to do that! ;-)

They got kicked out by the Romans after some fraticide. Are you sure their god
had nothing to do with that?

--
My name Indigo Montoya. | Enya go Bragh.
You flamed my father. | I'm whoever you want me to be.
Prepare to be spanked. | Annoying Usenet one post at a time.
Stop posting that! | At least I can stay in character.

JohnR

12/18/2011 12:27:00 AM

0

On 17/12/2011 11:54, Claire wrote:
> On Dec 15, 12:48 am, doug<doug.mor...@gmail.com> wrote:
>> On Dec 14, 12:23 pm, JohnR<repro...@hotmail.com> wrote:
>>
>>> On 14/12/2011 11:02, samson wrote:
>>
>>>> http://www.ahavat-israel.com/eretz/...
>>
>>> The zionist cult is all about land grabbing, theft and colonial
>>> expansion. It has no more of a legitimate claim to the land already
>>> stolen than to the land they desire to steal in the rest of the ME.
>>> Hardly surprising to see maps like these. It just exposes the cult for
>>> what it really is.
>>
>> No,no! God told them to rob the Palestinians of their
>> land, so it must be ok then, right? LOL
>
> To be fair the Jews are the only people still in existence who come
> from that land and have ever run it in iniquity. And yes, I am sure
> God has something to do that! ;-)

http://inventionofthejewishp...

China Blue Veins

12/18/2011 12:43:00 AM

0

In article <craHq.28531$mY.27313@unlimited.newshosting.com>,
JohnR <repro007@hotmail.com> wrote:

> On 17/12/2011 11:54, Claire wrote:
> > On Dec 15, 12:48 am, doug<doug.mor...@gmail.com> wrote:
> >> On Dec 14, 12:23 pm, JohnR<repro...@hotmail.com> wrote:
> >>
> >>> On 14/12/2011 11:02, samson wrote:
> >>
> >>>> http://www.ahavat-israel.com/eretz/...
> >>
> >>> The zionist cult is all about land grabbing, theft and colonial
> >>> expansion. It has no more of a legitimate claim to the land already
> >>> stolen than to the land they desire to steal in the rest of the ME.
> >>> Hardly surprising to see maps like these. It just exposes the cult for
> >>> what it really is.
> >>
> >> No,no! God told them to rob the Palestinians of their
> >> land, so it must be ok then, right? LOL
> >
> > To be fair the Jews are the only people still in existence who come
> > from that land and have ever run it in iniquity. And yes, I am sure
> > God has something to do that! ;-)
>
> http://inventionofthejewishp...

I believe argument stands
? 'God says' matters when claiming the land for Jews.
? 'God says' is irrelevant on whether the Jews are in exile.

--
My name Indigo Montoya. | Enya go Bragh.
You flamed my father. | I'm whoever you want me to be.
Prepare to be spanked. | Annoying Usenet one post at a time.
Stop posting that! | At least I can stay in character.

ColdWarDinosaur

12/18/2011 12:52:00 PM

0

Claire wrote:
> On Dec 15, 12:48 am, doug <doug.mor...@gmail.com> wrote:
>> On Dec 14, 12:23 pm, JohnR <repro...@hotmail.com> wrote:
>>
>>> On 14/12/2011 11:02, samson wrote:
>>>> http://www.ahavat-israel.com/eretz/...
>>> The zionist cult is all about land grabbing, theft and colonial
>>> expansion. It has no more of a legitimate claim to the land already
>>> stolen than to the land they desire to steal in the rest of the ME.
>>> Hardly surprising to see maps like these. It just exposes the cult for
>>> what it really is.
>> No,no! God told them to rob the Palestinians of their
>> land, so it must be ok then, right? LOL
>
> To be fair the Jews are the only people still in existence who come
> from that land and have ever run it in iniquity. And yes, I am sure
> God has something to do that! ;-)

Clair - unfortunately DNA proves that story wrong. The Jews of Ancient
Israel are where they have always been, except that they became
Muslims. They are the Palestinians, some Kurds, some Jordanians,
Lebanese and others scattered around the region. They ARE the Semites.
The new bunch are not, and are mainly from Eastern Europe. You cannot
escape your DNA. Hence the irony of the term, anti-semitic...

--
~~
HW
__________________
The GOP Claim TO Be Christian but are:
Pro-War.
Pro-Torture.
Pro-Execution.
Pro-Money-lender.
Anti-Human Rights.
Anti-Poor.
What's wrong with this picture??

Yitzhak Isaac Goldstein

12/18/2011 10:11:00 PM

0

ColdWarDinosaur <wynnehenry!@yahoo.co.uk> wrote:
> Claire wrote:
>> On Dec 15, 12:48 am, doug <doug.mor...@gmail.com> wrote:
>>> On Dec 14, 12:23 pm, JohnR <repro...@hotmail.com> wrote:
>>>
>>>> On 14/12/2011 11:02, samson wrote:
>>>>> http://www.ahavat-israel.com/eretz/...
>>>> The zionist cult is all about land grabbing, theft and colonial
>>>> expansion. It has no more of a legitimate claim to the land already
>>>> stolen than to the land they desire to steal in the rest of the ME.
>>>> Hardly surprising to see maps like these. It just exposes the cult for
>>>> what it really is.
>>> No,no! God told them to rob the Palestinians of their
>>> land, so it must be ok then, right? LOL
>>
>> To be fair the Jews are the only people still in existence who come
>> from that land and have ever run it in iniquity. And yes, I am sure
>> God has something to do that! ;-)
>
> Clair - unfortunately DNA proves that story wrong. The Jews of Ancient
> Israel are where they have always been, except that they became
> Muslims. They are the Palestinians

Ho, ho, ho. Claire, you have to excuse our anonymous little Nazi. He has
this 'portfolio' of claims that he brings out, each one in turn after the
previous one has been annihilated. The last one was his insistence that
the USS Liberty incident was 'murder' or 'deliberate' on the part of
Israel. When declassified SigInt was shown to him, demonstrating beyon a
_shadow_ of doubt that it was a tragic accident and that the Israelis
thought they were attacking an Egyptian ship, he dropped that one for a
while, but you can be sure he'll be back with it. Once he has given people
here enough time to forget his earlier drubbing, that is.

Anyway, the following should provide a good starting point for you...

'A 2006 study by Behar et al.,[33] based on high-resolution analysis of
Haplogroup K(mtDNA), suggested that about 40% of the current Ashkenazi
population is descended matrilineally from just four women, or "founder
lineages", that were "likely from a Hebrew/Levantine mtDNA pool"
originating in the Middle East in the 1st and 2nd centuries CE.
Moreover, a maternal line "sister" was found among the Jews of North
Africa, France, Italy, and Portugal...'
<http://en.wikipedia.org/wiki/Genetic_studies_o...

It's Wiki and so obviously not perfect, but it should serve to demonstrate
that little Nazis like our friend here, who don't even have the balls bigs
enough to post under their real name, are just _seriously_ pissed off that
Israel exists, and that the Jews aren't doing what we've historically been
expected to do, and that is to bend the neck even as we're being shot,
gassed and stabbed.

However bad it gets here, we always have the warm glow in our hearts, to
know that our very existence makes people like him spit blood.

Y.
--
Yitzhak Isaac Goldstein
'I know not with what weapons World War III will be fought, but World
War IV will be fought with sticks and stones'
(Albert Einstein (1879 - 1955))
<http://elderofziyon.blogspo...

Yitzhak Isaac Goldstein

12/18/2011 10:36:00 PM

0

Stars and Midnight China Blue <chine.bleu@yahoo.com> wrote:
> In article <craHq.28531$mY.27313@unlimited.newshosting.com>,
> JohnR <repro007@hotmail.com> wrote:
>
>> On 17/12/2011 11:54, Claire wrote:
>> > On Dec 15, 12:48 am, doug<doug.mor...@gmail.com> wrote:
>> >> On Dec 14, 12:23 pm, JohnR<repro...@hotmail.com> wrote:
>> >>
>> >>> On 14/12/2011 11:02, samson wrote:
>> >>
>> >>>> http://www.ahavat-israel.com/eretz/...
>> >>
>> >>> The zionist cult is all about land grabbing, theft and colonial
>> >>> expansion. It has no more of a legitimate claim to the land already
>> >>> stolen than to the land they desire to steal in the rest of the ME.
>> >>> Hardly surprising to see maps like these. It just exposes the cult for
>> >>> what it really is.
>> >>
>> >> No,no! God told them to rob the Palestinians of their
>> >> land, so it must be ok then, right? LOL
>> >
>> > To be fair the Jews are the only people still in existence who come
>> > from that land and have ever run it in iniquity. And yes, I am sure
>> > God has something to do that! ;-)
>>
>> http://inventionofthejewishp...
>
> I believe argument stands
> ? 'God says' matters when claiming Palestine is a Muslim Waqf
> ? 'God says' is irrelevant on whether Israel should exist

Typos corrected.

No, really : don't mention it.

Y.

--
Yitzhak Isaac Goldstein
Kaiser: 'Can you prove the existence of God?'
Bismarck: 'The Jews, Your Majesty. The Jews'
<http://elderofziyon.blogspo...