Dne 9.9.2013 12:21, Arvin Schnell napsal(a):
>
> Hi,
>
> what is the simplest Ruby based client to test SCR code?
>
> I tried something like this:
>
> module X
> include Yast
> r = SCR.Execute(path(".target.bash"), "/usr/bin/true")
> Builtins.y2milestone(r)
> end
>
> but here path is undefined.
If you include the Yast module, the 'path' method will be added to the
instance methods of the module X, which is a different scope from where
you expect it in the code example above.
This should work:
module X
include Yast
def scr_execute
SCR.Execute(path(".target.bash"), '/usr/bin/true')
end
end
The 'path' method is a shortcut for Yast::Path.new(*args) [1]. If you
want to use it in the module scope, you must specify the full namespace.
[1]
https://github.com/yast/yast-ruby-bindings/blob/master/src/ruby/yast/yast.rb
vlado
>
> Regards,
> Arvin
>
signature.asc
Description: OpenPGP digital signature
