paradigmatic / Configrity

Simple, immutable and flexible configuration library for scala.
Other
132 stars 19 forks source link

Please allow native Scala List for values #4

Closed nermin closed 12 years ago

nermin commented 13 years ago

To configure a value in the code which represents a List we have to write something like this:

val config = Configuration( ... "some.key.1" -> "[10]" "some.key.2" -> "[\"some string\"]" ... )

which looks ugly. What I would like to do is this:

val config = Configuration( ... "some.key.1" -> List(10) "some.key.2" -> "some string" :: Nil ... )

Thanks!

paradigmatic commented 12 years ago

I just added the feature you requested in the master branch. Can you please test it and tell me if it fits your needs ?

Please note that the syntax:

val config = Configuration(
  "some.key.2" -> "some string" :: Nil
)

won't work because -> has a higher priority than ::. You will need parenthesis:

val config = Configuration(
  "some.key.2" -> ( "some string" :: Nil )
)
nermin commented 12 years ago

Just tested, it works. Thank you!