Josselin schrieb:
> hos to have a conditional value  ?  :  :category => domain unless 
> domain.nil?

It doesn't make sense in this situation, because "domain unless domain.nil?" 
evauates to "nil" if "domain" contains "nil".

If you want to insert "nil" if "domain" is not yet defined use something like this:

irb(main):002:0> x = (domain ||= nil)
=> nil
irb(main):003:0> a = {:a => (domain ||= nil)}
=> {:a=>nil}

> [ :distance => radius.to_f , :category => domain unless domain.nil?, 
> :valid_until  => Time.now.utc]
> 
> but giving an error....   unexpected kUNLESS_MOD, expecting ']'

In other situations you should use parenthesis ":category => (domain unless 
domain.nil?)".

It is also possible to use the "?:" operator in some cases:

irb(main):007:0> a = [:a => (domain.nil??42:84)]
=> [{:a=>42}]

Wolfgang N?dasi-Donner