Class: SAPNW::RFC::FunctionCall
- Inherits:
-
Object
- Object
- SAPNW::RFC::FunctionCall
- Defined in:
- lib/sapnwrfc/functions.rb
Instance Attribute Summary collapse
-
#function_descriptor ⇒ Object
readonly
Returns the value of attribute function_descriptor.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
Instance Method Summary collapse
-
#activate(parm = nil) ⇒ Object
would ever need to be called.
-
#deactivate(parm = nil) ⇒ Object
amount of RFC traffic on the wire.
-
#initialize(fd = nil) ⇒ FunctionCall
constructor
do not instantiate these yourself!.
-
#method_missing(methid, *rest) ⇒ Object
dynamic method calls for parameters and tables.
Constructor Details
#initialize(fd = nil) ⇒ FunctionCall
do not instantiate these yourself!
SAPNW::RFC::FunctionCall objects allow dynamic method calls of parameter, and table names for the setting and getting of interface values eg:
fd = conn.discover("RFC_READ_TABLE")
f = fd.new_function_call
f.QUERY_TABLE = "T000" # <- QUERY_TABLE is a dynamic method serviced by method_missing
def initialize(fd=nil)
130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/sapnwrfc/functions.rb', line 130 def initialize(fd=nil) @parameters = {} if fd == nil @function_descriptor.parameters.each_pair do |k,v| @parameters[k] = v.clone end else fd.parameters.each_pair do |k,v| @parameters[k] = v.clone end end @parameters_list = @parameters.values || [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(methid, *rest) ⇒ Object
dynamic method calls for parameters and tables
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/sapnwrfc/functions.rb', line 160 def method_missing(methid, *rest) meth = methid.id2name #$stderr.print "method_missing: #{meth}\n" #$stderr.print "parameters: #{@parameters.keys.inspect}\n" if @parameters.has_key?(meth) #$stderr.print "return parm obj\n" return @parameters[meth].value elsif mat = /^(.*?)\=$/.match(meth) #$stderr.print "return parm val\n" if @parameters.has_key?(mat[1]) return @parameters[mat[1]].value = rest[0] else raise NoMethError end else raise NoMethodError end end |
Instance Attribute Details
#function_descriptor ⇒ Object (readonly)
Returns the value of attribute function_descriptor.
119 120 121 |
# File 'lib/sapnwrfc/functions.rb', line 119 def function_descriptor @function_descriptor end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
119 120 121 |
# File 'lib/sapnwrfc/functions.rb', line 119 def name @name end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
119 120 121 |
# File 'lib/sapnwrfc/functions.rb', line 119 def parameters @parameters end |
Instance Method Details
#activate(parm = nil) ⇒ Object
would ever need to be called.
146 147 148 149 |
# File 'lib/sapnwrfc/functions.rb', line 146 def activate(parm=nil) raise "Parameter not found: #{parm}\n" unless @parameters.has_key?(parm) return set_active(parm, 1) end |
#deactivate(parm = nil) ⇒ Object
amount of RFC traffic on the wire. This is especially important for unrequired tables, or parameters that are similar sources of large data transfer.
154 155 156 157 |
# File 'lib/sapnwrfc/functions.rb', line 154 def deactivate(parm=nil) raise "Parameter not found: #{parm}\n" unless @parameters.has_key?(parm) return set_active(parm, 0) end |