[yast-devel] YaST::Term on steroids
Hi, I would like to inform you, that class used for yast terms get some nice new features[1], that allows everyone to work with it with more pleasure way. It is documented inplace via yard on common place [2]. There are few I would like to highlight: * included Enumerable module that have a lot of common methods that works on parameters [3] * method empty? as it is often used in code to see if term have parameters and also it is quite common idiom used in ruby to have such method when we have method size * operator << which allows easy adding stuff to terms. Really useful for condition building of ui terms like ( just pseudo code ) box = VBox(Button, Button) box << Button if Arch.s390 * method nested_find that allows deep find of element in nested terms. It will be very useful for testing UI with something like (again just pseudocode): expect(Yast::UI).to receive(:OpenDialog) do |*arg| dialog_content = args.last password_frame = dialog_content.nested_find do |element| next unless element.is_a?(Yast::Term) # as it search even in string parameters element.value == :Frame && term.include?(Button("Encrypt")) end expect(password_frame).to_not eq nil end Welcome any comments and would like to see what you can done with it in new code Josef [1] https://github.com/yast/yast-ruby-bindings/pull/135 [2] http://www.rubydoc.info/github/yast/yast-ruby-bindings/master/Yast/Term [3] http://ruby-doc.org/core-2.2.0/Enumerable.html -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
participants (1)
-
Josef Reidinger