Forum: Ruby Using Ruby to read .properties file

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-06-06 17:54
(Received via mailing list)
Hi

I am working on a project in which I need to read and write the
.properties files. Is there a way to do this in Ruby ... other than
writing code from scratch.
Thanks in advance.

regards
Sanchit
Logan C. (Guest)
on 2006-06-06 18:08
(Received via mailing list)
On Jun 6, 2006, at 9:51 AM, removed_email_address@domain.invalid wrote:

> Hi
>
> I am working on a project in which I need to read and write the
> .properties files. Is there a way to do this in Ruby ... other than
> writing code from scratch.
> Thanks in advance.
>
> regards
> Sanchit

What is a .properties file? After some googling it looks like it's a
Java thing. Here's a project: http://raa.ruby-lang.org/project/
propertyfile/

(Two hints, 1) it's easier to help when your question is specific and
gives all the details and 2) Google is your friend (http://
www.google.com/search?hl=en&lr=&q=parse+java+.properties+file+in
+ruby&btnG=Search)
)
Edwin V. (Guest)
on 2006-06-06 18:29
unknown wrote:
> I am working on a project in which I need to read and write the
> .properties files. Is there a way to do this in Ruby ... other than
> writing code from scratch.
>
Have a look at yaml, It allows you to easily save objects in files and
read them. You can have an optionshash and just
File.open(propertiesfile, "w+") { |f| f.puts( optionshash.to_yaml ) }

hash = YAML.load( propertiesfile )

http://yaml4r.sourceforge.net/

Edwin
unknown (Guest)
on 2006-06-06 18:31
(Received via mailing list)
Thanks for the help and hints :)

sanchit




Logan C. <removed_email_address@domain.invalid>
06/06/2006 07:39 PM
Please respond to
removed_email_address@domain.invalid


To
removed_email_address@domain.invalid (ruby-talk ML)
cc

Subject
Re: Using Ruby to read .properties file







On Jun 6, 2006, at 9:51 AM, removed_email_address@domain.invalid wrote:

> Hi
>
> I am working on a project in which I need to read and write the
> .properties files. Is there a way to do this in Ruby ... other than
> writing code from scratch.
> Thanks in advance.
>
> regards
> Sanchit

What is a .properties file? After some googling it looks like it's a
Java thing. Here's a project: http://raa.ruby-lang.org/project/
propertyfile/

(Two hints, 1) it's easier to help when your question is specific and
gives all the details and 2) Google is your friend (http://
www.google.com/search?hl=en&lr=&q=parse+java+.properties+file+in
+ruby&btnG=Search)
)
This topic is locked and can not be replied to.