problem in Hash formatted output

J

jazzez ravi

Hi All,

I have an Array Like this

@output=[{"accounts"=>["id", "group_id", "company_id", "number", "name",
"opening_balance", "description", "editable", "created_at",
"updated_at", "source_account", "deleted_status", "alias",
"closing_balance", "flag"]},

{"blogs"=>["id", "category_id", "title", "content", "views",
"created_at", "updated_at"]},

{"categories"=>["id", "name"]}
{"clients"=>["id", "first_name", "last_name", "street1", "street2",
"city", "state", "zip", "country", "phone", "fax", "email", "website",
"flag", "created_at", "updated_at"]},

{"companies"=>["id", "client_id", "name", "street1", "street2", "city",
"state", "zip", "country", "phone", "fax", "email", "website", "flag",
"created_at", "updated_at", "business_number", "year_end_date",
"net_days", "selected_province", "tax", "plan_name", "error_display",
"logo_display_flag", "business_type", "user_id"]},

{"company_details"=>["id", "content_type", "filename", "size",
"parent_id", "thumbnail", "width", "height", "db_file_id",
"attachable_type", "attachable_id"]},

{"contacts"=>["id", "company_id", "company_name", "first_name",
"last_name", "title", "street1", "street2", "city", "state", "zip",
"country", "phone", "email", "fax", "website", "contact_type",
"created_at", "updated_at", "account_id", "flag"]},

{"countries"=>["id", "name", "code"]}]


This is my array. I want to get exactly like this Output format

OUTPUT:

01.accounts
id
group_id
company_id
number
name
opening_balance
description
editable
created_at
updated_at
source_account
deleted_status
alias
closing_balance
flag
------------------------
02.blogs
id
category_id
title
content
views
created_at
updated_at
-----------------------

AND So ON


Please provide a code for it


Thanks,
P.Raveendran
http://raveendran.wordpress.com
 
R

Robert Klemme

I have an Array Like this
This is my array. I want to get exactly like this Output format
Please provide a code for it

Another attempt to abuse the community to write code for free. For this
to work you should provide a much more interesting problem than
formatting output of a nested data structure.

Alternative show the code you have got so far and we'll be happily
helping out where you have problems.

Regards

robert
 
S

Stefan Rusterholz

jazzez said:
Hi All,

I have an Array Like this *snip*
This is my array. I want to get exactly like this Output format *snip*
Please provide a code for it

There is a difference between *help* and *solutions*. Help you might get
for free here (depends a lot on you, e.g. attitude, proper information
etc.), but if you want solutions, go and get some contractor. That's
what you *pay* for.

Regards
Stefan
 
C

Constantine Karnacevych

Stefan said:
There is a difference between *help* and *solutions*. Help you might get
for free here (depends a lot on you, e.g. attitude, proper information
etc.), but if you want solutions, go and get some contractor. That's
what you *pay* for.

2 jazzez ravi =>
agreed :)

2 Stefan Rusterholz =>
what for do you need this
for debugging reason you may use 'pp'
eg. require 'pp'; pp @output

else you have to write your own method if you need this being
implemented
a lot of samples exist in the network, just carefully dig
 
J

jazzez ravi

Hi All,

Thanks for your kind information. I requested to my client for provide a
full code to me. And also suggest the output format like this,

accounts=["id",
"group_id",
"company_id",
"number",
" name",
" opening_balance",
" description",
" editable",
" updated_at",
" source_account",
" deleted_status",
" alias",
" closing_balance",
" flag"]

output=[accounts,blogs]

I have only the above output format which is mentioned the Top of the
Post.Thats why asking suggestion from U Guys. Anyway let u know after
getting info from My client.

Thanks,
P.Raveendran
http://raveendran.wordpress.com
 

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
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top