Using Ruby to read .properties file


#1

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


#2

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)
)


#3

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


#4

Thanks for the help and hints :slight_smile:

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)
)