On Tue, 2009-11-24 at 16:14 -0800, Markus Roberts wrote:
> 
>         +                ref = AllReferences[i.name]
>         +                ref = @context.find_symbol(i.name) unless ref
>         +                ref = ref.viewer if ref and
>         ref.respond_to?(:viewer)
> 
> Not worth worrying about, but just to note it, this could be
> simplified to:
> 
>                 ref = AllReferences[i.name] ||
> @context.find_symbol(i.name)
>                 ref = ref.viewer if ref.respond_to?(:viewer)

Correct, that's better.

>  
>         +            rl = build_realize_list(@context)
>         +            @values["realizes"] = rl unless rel.empty?
>         +
> 
> Is this supposed to be ("rl" vs. "rel")?:

Yes, I fixed it after sending the patch (it wasn't worth resending).

>             @values["realizes"] = rl unless rl.empty?
>   
> 
>         +    def resource_stmt_to_ref(stmt)
>         +        type = stmt.type.split("::").collect { |s|
>         s.capitalize }.join("::")
>         +        title =
>         stmt.title.is_a?(Puppet::Parser::AST::ASTArray) ?
>         stmt.title.to_s.gsub(/\[(.*)\]/,'\1') : stmt.title.to_s
>         +
>         +        param = []
>         +        stmt.params.children.each do |p|
>         +            res = {}
>         +            res["name"] = p.param
>         +            res["value"] = "#{p.value.to_s}" unless
>         p.value.nil?
>         +
>         +            param << res
>         +        end
> 
> Again, just to note it, this could be written:
> 
>         param = stmt.params.children.collect do |p|
>             res = {"name" => p.param}
>             res["value"] = p.value.to_s unless p.value.nil?
>             res
>         end
> 
> or possibly even:
> 
>         param = stmt.params.children.collect do |p|
>             {"name" => p.param, "value" => p.value.to_s}
>         end
> 
>  depending on the reason for skipping value if nil.

I'm not sure, I'll have a look to the use of this hash (this is code
modeled from what RDoc does for function argument, hence its, hmm,
quality).
Ruby question: does nil.to_s raises an exception or produces ""?
(I know I can check by myself, but I feel lazy this morning)

-- 
Brice Figureau
Follow the latest Puppet Community evolutions on www.planetpuppet.org!

--

You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.


Reply via email to