Class: Yast::FunRef
- Inherits:
-
Object
- Object
- Yast::FunRef
- Defined in:
- src/ruby/yast/fun_ref.rb,
src/ruby/yast/ops.rb,
src/ruby/yast/yast.rb,
src/ruby/yast/builtins.rb
Overview
Provides wrapper to pass reference to function. It is used by component system to allow passing reference to function. Class is immutable
Instance Attribute Summary collapse
-
#remote_method ⇒ Object
readonly
reference to method responds to method call.
-
#signature ⇒ Object
readonly
Signature recognized by YCPType.
Instance Method Summary collapse
-
#call(*args) ⇒ Object
Forwards call to reference method.
-
#initialize(met, signature) ⇒ FunRef
constructor
A new instance of FunRef.
Constructor Details
#initialize(met, signature) ⇒ FunRef
Returns a new instance of FunRef.
21 22 23 24 25 26 27 28 29 |
# File 'src/ruby/yast/fun_ref.rb', line 21 def initialize(met, signature) @remote_method = met raise "invalid argument #{met.inspect}" unless met.respond_to? :call # expand signature to containt full spec of lists and maps signature = signature.gsub(/map(\s*([^<\s]|$))/, "map<any,any>\\1") signature = signature.gsub(/list(\s*([^<\s]|$))/, "list<any>\\1") @signature = signature end |
Instance Attribute Details
#remote_method ⇒ Object (readonly)
reference to method responds to method call
19 20 21 |
# File 'src/ruby/yast/fun_ref.rb', line 19 def remote_method @remote_method end |
#signature ⇒ Object (readonly)
Signature recognized by YCPType
17 18 19 |
# File 'src/ruby/yast/fun_ref.rb', line 17 def signature @signature end |
Instance Method Details
#call(*args) ⇒ Object
Forwards call to reference method
32 33 34 |
# File 'src/ruby/yast/fun_ref.rb', line 32 def call(*args) @remote_method.call(*args) end |