Returns minor version.
tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents') puts tobj.minor_version # => 2
Returns the type library major version.
tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') puts tlib.major_version # -> 1
Returns the type library minor version.
tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') puts tlib.minor_version # -> 3
Try to convert obj into a hash, using to_hash
method. Returns converted hash or nil if obj cannot be converted for any reason.
Hash.try_convert({1=>2}) # => {1=>2} Hash.try_convert("1=>2") # => nil
This method is a shortcut for converting a single line of a CSV
String into an Array. Note that if line
contains multiple rows, anything beyond the first row is ignored.
The options
parameter can be anything CSV::new()
understands.
Returns true
if unconverted_fields() to parsed results. See CSV::new
for details.
Returns the current list of converters in effect for headers. See CSV::new
for details. Built-in converters will be returned by name, while others will be returned as is.
Identical to CSV#convert()
, but for header rows.
Note that this method must be called before header rows are read to have any effect.
The actual work method for adding converters, used by both CSV.convert()
and CSV.header_convert()
.
This method requires the var_name
of the instance variable to place the converters in, the const
Hash
to lookup named converters in, and the normal parameters of the CSV.convert()
and CSV.header_convert()
methods.
Processes fields
with @converters
, or @header_converters
if headers
is passed as true
, returning the converted field set. Any converter that changes the field into something other than a String halts the pipeline of conversion for that field. This is primarily an efficiency shortcut.
This method is used to turn a finished row
into a CSV::Row
. Header rows are also dealt with here, either by returning a CSV::Row
with identical headers and fields (save that the fields do not go through the converters) or by reading past them to return a field row. Headers are also saved in @headers
for use in future rows.
When nil
, row
is assumed to be a header row not based on an actual row of the stream.
Returns a string for DNS reverse lookup compatible with RFC3172.
Set
date-time format.
datetime_format
A string suitable for passing to strftime
.
Returns the date format being used. See datetime_format=
Returns the factorization of value
.
value
An arbitrary integer.
generator
Optional. A pseudo-prime generator. generator
.succ must return the next pseudo-prime number in the ascending order. It must generate all prime numbers, but may also generate non prime numbers too.
ZeroDivisionError
when value
is zero.
For an arbitrary integer:
n = p_1**e_1 * p_2**e_2 * .... * p_n**e_n,
prime_division
(n) returns:
[[p_1, e_1], [p_2, e_2], ...., [p_n, e_n]]. Prime.prime_division(12) #=> [[2,2], [3,1]]
Ruby tries to load the library named string relative to the requiring file’s path. If the file’s path cannot be determined a LoadError
is raised. If a file is loaded true
is returned and false otherwise.
Parse a file at filename
. Returns the Psych::Nodes::Document
.
Raises a Psych::SyntaxError
when a YAML syntax error is detected.
Parse a YAML string in yaml
. Returns the Psych::Nodes::Stream
. This method can handle multiple YAML documents contained in yaml
. filename
is used in the exception message if a Psych::SyntaxError
is raised.
If a block is given, a Psych::Nodes::Document
node will be yielded to the block as it’s being parsed.
Raises a Psych::SyntaxError
when a YAML syntax error is detected.
Example:
Psych.parse_stream("---\n - a\n - b") # => #<Psych::Nodes::Stream:0x00> Psych.parse_stream("--- a\n--- b") do |node| node # => #<Psych::Nodes::Document:0x00> end begin Psych.parse_stream("--- `", "file.txt") rescue Psych::SyntaxError => ex ex.file # => 'file.txt' ex.message # => "(file.txt): found character that cannot start any token" end
See Psych::Nodes
for more information about YAML AST.
Returns the version of libyaml being used