* Josef Reidinger <[email protected]> [Jun 25. 2013 13:26]:
> > 
> > libyui-bindings has more complete examples
> > (https://github.com/kkaempf/libyui-bindings/tree/master/swig/ruby/examples)
> > which could help guiding a decision.
> 
> To be honest, I don't like this examples, it looks like old C gtk where
> create every element is pain.

Lol - I don't like it either. It should just server as an example for
the discussion.

> Compare this examples with elegance of
> translated YCP code -
> https://github.com/kobliha/yast-services-manager/blob/master/src/clients/services-manager.rb#L83

Thanks, thats helpful. I was missing this context.

> 
> I just want to get rid of annoying id, header and opt term. So after
> your comments I propose to create shortcuts
> Id, Opt and Header that creates such terms.

This is one (nice) way to solve this.

  ComboBox(
    term(:id, IDs::DEFAULT_TARGET),
    term(:opt, :notify),
    _('Default System &Target'),
    []
  )

would change to

  ComboBox(
    Id(IDs::DEFAULT_TARGET),
    Opt(:notify),
    _('Default System &Target'),
    []
  )

Another, probably more Ruby-like, is using hashes (as trailing
arguments):

  ComboBox _('Default System &Target'), [], :id => IDs::DEFAULT_TARGET, :opt => 
:notify,

[I removed the parantheses for ComboBox for readability]

(see http://mikepackdev.com/blog_posts/8-tuesday-tricks-splatting for
example)

Comments ?


Klaus
-- 
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 
16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany
-- 
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to