Using Ruby to read .properties file

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

On Jun 6, 2006, at 9:51 AM, [email protected] 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)
)

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 )

Edwin

Thanks for the help and hints :slight_smile:

sanchit

Logan C. [email protected]
06/06/2006 07:39 PM
Please respond to
[email protected]

To
[email protected] (ruby-talk ML)
cc

Subject
Re: Using Ruby to read .properties file

On Jun 6, 2006, at 9:51 AM, [email protected] 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)
)