module RubymentDeprecatedModule
# begin_documentation This module receives only functions that are deprecated. They are still kept in Rubyment, but they won't receive more updates, because there is a different more modern way of achieving the same results. The functions here are also not used by any function in #RubymentMaintainedModule. # end_documentation
Public Instance Methods
# documentation_begin # short_desc = “tests the function exception_information_base
” @memory.push = {
:function => :exception_information_base, :short_desc => short_desc, :description => "", :params => [ { :name => :args, :description => "list of parameters", :duck_type => Array, :default_behavior => [], :params => [ { :name => :exception, :duck_type => Exception, :default_behavior => nil, :description => "exception to extract info from", }, { :name => :max_str_index, :duck_type => FixNum, :default_behavior => -1, :description => "limit the full string output to this last index", }, { :name => :reserved, :duck_type => Object, :default_behavior => nil, :description => "reserved for future use", }, ], }, ], :return_value => [ { :name => :short, :duck_type => String, :default_behavior => "", :description => "a brief about the exception; normally an exception inspection", }, { :name => :full, :duck_type => String, :default_behavior => "", :description => "all the information about the exception; normally an exception inspection and bactrace", }, { :name => :inspection, :duck_type => String, :default_behavior => "", :description => "the exception inspection", }, { :name => :backtrace, :duck_type => Object, :duck_type => [:_a, Array, :strings], :description => the exception bactrace", }, { :name => :reserved, :duck_type => Object, :default_behavior => nil, :description => "reserved for future use", }, ],
} # documentation_end
# File lib/rubyment.rb, line 4034 def exception_information_base args=[] exception, max_str_index, reserved = args inspection = exception.inspect backtrace = exception.backtrace short = inspection full = ( [ "inspection (message):", inspect, "", "backtrace:", "", ] + backtrace.to_a ).join "\n" full = string_truncate [ full, max_str_index, ] [short, full, inspection, backtrace] end
inverse of file__json note that, contrary to the common convention, the debug output is on for this function (due to a mistake, and to respect API-backwards-compatibility)
# File lib/rubyment.rb, line 4164 def load__file_json args=[] require 'json' file_path, quiet, reserved = args debug = quiet.nne.negate_me stderr = @memory[:stderr] debug && (stderr.puts "{#{__method__} starting") debug && (stderr.puts "caller=#{caller_label}") debug && (stderr.puts "args=#{args.inspect}") file_contents = File.read file_path debug && (stderr.puts "file_contents size=#{file_contents.size}") loaded = JSON.parse file_contents debug && (stderr.puts "loaded size=#{loaded.size}") debug && (stderr.puts "loaded=#{loaded.inspect}") rv = loaded[:root.to_s] # if raises exception before it will be unbalanced : debug && (stderr.puts "#{__method__} will return #{rv.inspect}") debug && (stderr.puts "#{__method__} returning}") rv end
use tcp_ssl_server opens one or more TCP and/or SSL server accepting connections. @param [Array] args
, an Array
whose elements are expected to be:
listening_port
- String, Integer
-
port to listen
ip_addr
- String, nil
-
ip (no hostname) to bind the server. 0, nil, false, empty string will bind to all addresses possible. 0.0.0.0 => binds to all ipv4 . ::0 to all ipv4 and ipv6
admit_plain
- Boolean
-
if
true
, tries to create a normalTCPServer
, if not possible to createSSLServer
(default:false
, for preventing unadvertnt non-SSL server creation)
debug
Object
-
for future use
callback_method
- String, Method
-
method to call when a client connects. The method must accept a socket as parameter.
callback_method_args
- Array
-
args to be given to the call_back_method. Note that the type differs from tcp_server_plain (which takes splat)
@return [Array] returns a , an Array
whose elements are:
threads
- Array of Thread
-
returns an Array of Thread object looping for accepting incoming connections (call join on those object for waiting for its completion).
# File lib/rubyment.rb, line 4091 def tcp_ssl_servers args = ARGV stderr = @memory[:stderr] listening_port, ip_addr, debug, admit_plain, callback_method, callback_method_args, priv_pemfile, cert_pem_file, extra_cert_pem_files, output_exception, reserved = args server = (ssl_make_servers [ listening_port, ip_addr, debug, admit_plain, priv_pemfile, cert_pem_file, extra_cert_pem_files, output_exception, ]).first.first debug.nne && (stderr.puts server) Thread.start { loop { client = runea ["yes, rescue", "yes, output exception", "nil on exception" ] { server.accept } Thread.start(client) { |client| debug.nne && (stderr.puts Thread.current) debug.nne && (stderr.puts client) runoe { to_method([callback_method]) .call([client] + callback_method_args) } } } } end
# File lib/rubyment.rb, line 4146 def test__file_read___http_request_response__curl args=[] # these tests depend on internet connection, so it may be difficult # to automate them. url_1 = "https://www.google.com/" url_1 = "http://www.google.com/" url_1 = "https://localhost:8003/" url_1 = "https://localhost:8003/" url_1 = "http://localhost:8004/tinga" p file_read [url_1, nil, nil, nil, nil, :skip_open_uri, :payload.to_nil, false, nil, nil, nil, nil, :http_request_response__curl] end
calls a function with the processing arg @param [Array] args
, an Array
whose elements are expected to be:
processing_arg
method
- Method, String
method_args
- Array
-
args to be given to the
transform_method_name
on_object
- String, Boolean
@return [String] processing_arg
# File lib/rubyment.rb, line 4068 def test__transform_call args = ARGV processing_arg, method, method_args, on_object = args object_arg = on_object.nne && processing_arg || nil p args to_method( [method, object_arg]).call( [processing_arg] + method_args ) end
# File lib/rubyment.rb, line 4137 def test_cases_template args=[] # testing_method = :send_enumerator test_cases ||= [ # [ :id, :expectation, :actual_params ], # actual_params can be an array with method_name + args to that method. ] end