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.
Tiago N. (Guest)
on 2009-02-04 03: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 = removed_email_address@domain.invalid

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
unknown (Guest)
on 2009-02-04 14: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 => "removed_email_address@domain.invalid"}
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: removed_email_address@domain.invalid

Peter
___
http://www.rubyrailways.com
http://scrubyt.org
unknown (Guest)
on 2009-02-04 14: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
Dominik H. (Guest)
on 2009-02-04 16: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 = removed_email_address@domain.invalid

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')
unknown (Guest)
on 2009-02-04 17: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 H. 
<removed_email_address@domain.invalid>
unknown (Guest)
on 2009-02-04 17: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.