Forum: Ruby RProperties 0.0.1 Released

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.
A745f7d401d0a9bf80a5d5d94c961a05?d=identicon&s=25 Tiago Nogueira (Guest)
on 2009-02-04 02:43
(Received via mailing list)
Hello everybody!
The first release of RProperties is on the RubyForge now on
http://rubyforge.org/projects/rproperties/ !
RProperties is a simple (very simple) implementation of the Java
Properties feature.
In this first release i just put the VERY basic functionality but i´m
working to do more things on it.

Just to exemplify a use of RProperties :
1. Imagine that you have a .properties file containing :
site_name   = My Crazy Blog About Ruby
site_author  =  Barack Obama
author_email = barack@whitehouse.org

2. Using RProperties :

require 'r_properties'
rp = RProperties.new("my_file.properties");
rp.load_p;
puts "The name of my site is #{rp.get_p("site_name")}"

That´s All! I know that i have too much work to do and i hope that
everybody help on it.
- tiago
F50f5d582d76f98686da34917531fe56?d=identicon&s=25 unknown (Guest)
on 2009-02-04 13:21
(Received via mailing list)
> Hello everybody!
> The first release of RProperties is on the RubyForge now on
> http://rubyforge.org/projects/rproperties/ !

Great! But I don't really get the advantage of RProperties over built in
yaml+hash for example (or yaml+struct, or... whatever):

store:

props = {:site_name => "My Crazy Blog About Ruby",
   :site_author => "Barack Obama",
   :author_email => "barack@whitehouse.org"}
open('my_props.yml','w') {|f| f.write props.to_yaml}

load:

rp = YAML::load(open('my_props.yml'))
puts rp[:site_name]
puts rp[:site_author]
etc.

the yaml file almost looks like the java properties file:

---
:site_name: " My Crazy Blog About Ruby"
:site_author: Barack Obama
:author_email: barack@whitehouse.org

Peter
___
http://www.rubyrailways.com
http://scrubyt.org
A745f7d401d0a9bf80a5d5d94c961a05?d=identicon&s=25 unknown (Guest)
on 2009-02-04 13:43
(Received via mailing list)
You are completly right Peter!

But my intention to make rproperties is to mantain the java way and ,
with
this, convence more java users
here in brazil to migrate to ruby, and migrating , they will be
completly
free to use the ruby ways and discover this wonderfull language , that i
prefer too! Peter , here in Brazil i am finding a hard resistence with
the
java users to migrate to Ruby. I guess that in a group of 100 developers
here , 10 are tendencious to migrate to ruby,15 says that will take a
look
but always says : tomorrow , tomorrow i'll see some and 75 just will
change
when ruby pays more that java.

- tiago
47aff267a58c012d222fd4d74f6beb54?d=identicon&s=25 Dominik Honnef (Guest)
on 2009-02-04 15:34
(Received via mailing list)
> But my intention to make rproperties is to mantain the java way and , with
> this, convence more java users
> here in brazil to migrate to ruby, and migrating , they will be completly
> free to use the ruby ways and discover this wonderfull language , that i
> prefer too!

I doubt that people coming from Java will discover the beauty of Ruby
if they are able to use things like RProperties. And in my opinion,
something like #get_p(...) is not Ruby-like at all.

The proper way would be to actually show them how it is done in Ruby's
way.

> site_name   = My Crazy Blog About Ruby
> site_author  =  Barack Obama
> author_email = barack@whitehouse.org

By simply adding "" around the values, you could even use this kind of
format with, e.g., instance_eval and provide an interface like the
following:

  Properties.site_name

to get the value of site_name, which is way nicer than
get_p('site_name')
A745f7d401d0a9bf80a5d5d94c961a05?d=identicon&s=25 unknown (Guest)
on 2009-02-04 16:39
(Received via mailing list)
Dominik,
I just put the ideas on the air and i'm open to sugestions etc...
This is the first release and i know that i have too much work to do and
if
somebody
have other ideas please , lets talk!
- tiago

On Wed, 4 Feb 2009 23:33:21 +0900, Dominik Honnef <dominikho@gmx.net>
A745f7d401d0a9bf80a5d5d94c961a05?d=identicon&s=25 unknown (Guest)
on 2009-02-04 16:45
(Received via mailing list)
Dominik, you said:
"...
By simply adding "" around the values, you could even use this kind of
format with, e.g., instance_eval and provide an interface like the
following: Properties.site_name to get the value of site_name, which is
way
nicer than get_p('site_name')
..."

And i was think thats can be a good way.
- tiago
This topic is locked and can not be replied to.