Returns the source encoding as an Encoding
object.
Synonym for CGI.unescapeElement(str)
Parses multipart form elements according to
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2
Returns a hash of multipart form parameters with bodies of type StringIO
or Tempfile
depending on whether the multipart form element exceeds 10 KB
params[name => body]
Generate a Form element with multipart encoding as a String
.
Multipart encoding is used for forms that include file uploads.
action
is the action to perform. enctype
is the encoding type, which defaults to “multipart/form-data”.
Alternatively, the attributes can be specified as a hash.
multipart_form{ "string" } # <FORM METHOD="post" ENCTYPE="multipart/form-data">string</FORM> multipart_form("url") { "string" } # <FORM METHOD="post" ACTION="url" ENCTYPE="multipart/form-data">string</FORM>
A utility method for encoding the String
s as a URL.
require "erb" include ERB::Util puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
Generates
Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
A utility method for encoding the String
s as a URL.
require "erb" include ERB::Util puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
Generates
Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
Returns the value of field 'Content-Length'
as an integer, or nil
if there is no such field; see Content-Length request header:
res = Net::HTTP.get_response(hostname, '/nosuch/1') res.content_length # => 2 res = Net::HTTP.get_response(hostname, '/todos/1') res.content_length # => nil
Sets the value of field 'Content-Length'
to the given numeric; see Content-Length response header:
_uri = uri.dup hostname = _uri.hostname # => "jsonplaceholder.typicode.com" _uri.path = '/posts' # => "/posts" req = Net::HTTP::Post.new(_uri) # => #<Net::HTTP::Post POST> req.body = '{"title": "foo","body": "bar","userId": 1}' req.content_length = req.body.size # => 42 req.content_type = 'application/json' res = Net::HTTP.start(hostname) do |http| http.request(req) end # => #<Net::HTTPCreated 201 Created readbody=true>
Returns a value representing the “cost” of transforming str1 into str2 Vendored version of DidYouMean::Levenshtein.distance from the ruby/did_you_mean gem @ 1.4.0 github.com/ruby/did_you_mean/blob/2ddf39b874808685965dbc47d344cf6c7651807c/lib/did_you_mean/levenshtein.rb#L7-L37
END {} ^^^^^^
BEGIN {} ^^^^^^^^
Remove everything in the DependencyList
that matches but doesn’t satisfy items in dependencies
(a hash of gem names to arrays of dependencies).
until foo; bar end ^^^^^^^^^^^^^^^^^
bar until foo ^^^^^^^^^^^^^
Returns value specified by the member name of VT_RECORD OLE object. If the member name is not correct, KeyError
exception is raised. If you can’t access member variable of VT_RECORD OLE object directly, use this method.
If COM server in VB.NET ComServer project is the following:
Imports System.Runtime.InteropServices Public Class ComClass Public Structure ComObject Public object_id As Ineger End Structure End Class
and Ruby Object
class has title attribute:
then accessing object_id of ComObject from Ruby is as the following:
srver = WIN32OLE.new('ComServer.ComClass') obj = WIN32OLE::Record.new('ComObject', server) # obj.object_id returns Ruby Object#object_id obj.ole_instance_variable_get(:object_id) # => nil
Sets value specified by the member name of VT_RECORD OLE object. If the member name is not correct, KeyError
exception is raised. If you can’t set value of member of VT_RECORD OLE object directly, use this method.
If COM server in VB.NET ComServer project is the following:
Imports System.Runtime.InteropServices Public Class ComClass <MarshalAs(UnmanagedType.BStr)> _ Public title As String Public cost As Integer End Class
then setting value of the ‘title’ member is as following:
srver = WIN32OLE.new('ComServer.ComClass') obj = WIN32OLE::Record.new('Book', server) obj.ole_instance_variable_set(:title, "The Ruby Book")
unless foo; bar end ^^^^^^^^^^^^^^^^^^^
bar unless foo ^^^^^^^^^^^^^^