Sets the curve parameters. generator must be an instance of EC::Point
that is on the curve. order and cofactor are integers.
See the OpenSSL
documentation for EC_GROUP_set_generator()
Initializes a copy of a {DependencyGraph}, ensuring that all {#vertices} are properly copied. @param [DependencyGraph] other the graph to copy.
Sets the payload of the vertex with the given name @param [String] name the name of the vertex @param [Object] payload the payload @return [Void]
Search for the specifications that match the given dependency. The specifications in the returned array will be considered in reverse order, so the latest version ought to be last. @note This method should be ‘pure’, i.e. the return value should depend
only on the `dependency` parameter.
@param [Object] dependency @return [Array<Object>] the specifications that satisfy the given
`dependency`.
Adds this spec’s require paths to LOAD_PATH, in the proper location.
Returns self
.
Drops elements up to, but not including, the first element for which the block returns nil
or false
and returns an array containing the remaining elements.
If no block is given, an Enumerator
is returned instead.
See also Array#take_while
a = [1, 2, 3, 4, 5, 0] a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0]
Returns the singleton class of obj. This method creates a new singleton class if obj does not have one.
If obj is nil
, true
, or false
, it returns NilClass
, TrueClass
, or FalseClass
, respectively. If obj is an Integer
, a Float
or a Symbol
, it raises a TypeError
.
Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>> String.singleton_class #=> #<Class:String> nil.singleton_class #=> NilClass
Yields self to the block and returns the result of the block.
3.next.then {|x| x**x }.to_s #=> "256" "my string".yield_self {|s| s.upcase } #=> "MY STRING"
Good usage for yield_self
is value piping in method chains:
require 'open-uri' require 'json' construct_url(arguments). yield_self {|url| open(url).read }. yield_self {|response| JSON.parse(response) }
When called without block, the method returns Enumerator
, which can be used, for example, for conditional circuit-breaking:
# meets condition, no-op 1.yield_self.detect(&:odd?) # => 1 # does not meet condition, drop value 2.yield_self.detect(&:odd?) # => nil
Returns an array of the names of singleton methods for obj. If the optional all parameter is true, the list will include methods in modules included in obj. Only public and protected singleton methods are returned.
module Other def three() end end class Single def Single.four() end end a = Single.new def a.one() end class << a include Other def two() end end Single.singleton_methods #=> [:four] a.singleton_methods(false) #=> [:two, :one] a.singleton_methods #=> [:two, :one, :three]