Sets the environment variable name
to value
. If the value given is nil
the environment variable is deleted. name
must be a string.
Stores an individual Ruby object or a hierarchy of Ruby objects in the data store file under the root name. Assigning to a name already in the data store clobbers the old data.
require "pstore" store = PStore.new("data_file.pstore") store.transaction do # begin transaction # load some data into the store... store[:single_object] = "My data..." store[:obj_hierarchy] = { "Kev Jackson" => ["rational.rb", "pstore.rb"], "James Gray" => ["erb.rb", "pstore.rb"] } end # commit changes to data store file
WARNING: This method is only valid in a PStore#transaction
and it cannot be read-only. It will raise PStore::Error
if called at any other time.
Attribute Assignment—Sets or creates the value of a fiber-local variable, using either a symbol or a string.
See also Thread#[]
.
For thread-local variables, please see thread_variable_set
and thread_variable_get
.
Adds a post-installs hook that will be passed a Gem::DependencyInstaller
and a list of installed specifications when Gem::DependencyInstaller#install
is complete
Take equal portions of Mike Stok and Sean Russell; mix vigorously, and pour into a tall, chilled glass. Serves 10,000.
Returns the list of Modules
nested at the point of call.
module M1 module M2 $a = Module.nesting end end $a #=> [M1::M2, M1] $a[0].name #=> "M1::M2"
Set
the handling of the ordering of options and arguments. A RuntimeError
is raised if option processing has already started.
The supplied value must be a member of GetoptLong::ORDERINGS
. It alters the processing of options as follows:
REQUIRE_ORDER :
Options are required to occur before non-options.
Processing of options ends as soon as a word is encountered that has not been preceded by an appropriate option flag.
For example, if -a and -b are options which do not take arguments, parsing command line arguments of ‘-a one -b two’ would result in ‘one’, ‘-b’, ‘two’ being left in ARGV, and only (‘-a’, ”) being processed as an option/arg pair.
This is the default ordering, if the environment variable POSIXLY_CORRECT is set. (This is for compatibility with GNU getopt_long.)
PERMUTE :
Options can occur anywhere in the command line parsed. This is the default behavior.
Every sequence of words which can be interpreted as an option (with or without argument) is treated as an option; non-option words are skipped.
For example, if -a does not require an argument and -b optionally takes an argument, parsing ‘-a one -b two three’ would result in (‘-a’,”) and (‘-b’, ‘two’) being processed as option/arg pairs, and ‘one’,‘three’ being left in ARGV.
If the ordering is set to PERMUTE but the environment variable POSIXLY_CORRECT is set, REQUIRE_ORDER is used instead. This is for compatibility with GNU getopt_long.
RETURN_IN_ORDER :
All words on the command line are processed as options. Words not preceded by a short or long option flag are passed as arguments with an option of ” (empty string).
For example, if -a requires an argument but -b does not, a command line of ‘-a one -b two three’ would result in option/arg pairs of (‘-a’, ‘one’) (‘-b’, ”), (”, ‘two’), (”, ‘three’) being processed.
Returns the binding associated with prc. Note that Kernel#eval
accepts either a Proc
or a Binding
object as its second parameter.
def fred(param) proc {} end b = fred(99) eval("param", b.binding) #=> 99
Return the generated binding object from event
Returns a Binding
object, describing the variable and method bindings at the point of call. This object can be used when calling eval
to execute the evaluated command in this environment. See also the description of class Binding
.
def get_binding(param) binding end b = get_binding("hello") eval("param", b) #=> "hello"
Set
struct member name
, to value val
Set
the value at index
to int
.
Or, set the memory at start
until length
with the contents of string
, the memory from dl_cptr
, or the memory pointed at by the memory address addr
.
Sets a specific section
name with a Hash
pairs
Given the following configuration being created:
config = OpenSSL::Config.new #=> #<OpenSSL::Config sections=[]> config['default'] = {"foo"=>"bar","baz"=>"buz"} #=> {"foo"=>"bar", "baz"=>"buz"} puts config.to_s #=> [ default ] # foo=bar # baz=buz
It’s important to note that this will essentially merge any of the keys in pairs
with the existing section
. For example:
config['default'] #=> {"foo"=>"bar", "baz"=>"buz"} config['default'] = {"foo" => "changed"} #=> {"foo"=>"changed"} config['default'] #=> {"foo"=>"changed", "baz"=>"buz"}
Creates a weak reference from the given key to the given value
Set
the session data for key key
.
Looks up the field by the semantics described in CSV::Row.field()
and assigns the value
.
Assigning past the end of the row with an index will set all pairs between to [nil, nil]
. Assigning to an unused header appends the new pair.
In the default mixed mode, this method assigns rows for index access and columns for header access. You can force the index association by first calling by_col
!() or by_row
!().
Rows may be set to an Array of values (which will inherit the table’s headers()) or a CSV::Row
.
Columns may be set to a single value, which is copied to each row of the column, or an Array of values. Arrays of values are assigned to rows top to bottom in row major order. Excess values are ignored and if the Array does not have a value for each row the extra rows will receive a nil
.
Assigning to an existing column or row clobbers the data. Assigning to new columns creates them at the right end of the table.
Stores value v
at key
in the GW
Sets an element, replacing any previous matching element. If no existing element is found ,the element is added.
Used to find a matching element to replace. See []().
The element to replace the existing element with the previous element
nil if no previous element was found.
doc = Document.new '<a/>' doc.root.elements[10] = Element.new('b') #-> <a><b/></a> doc.root.elements[1] #-> <b/> doc.root.elements[1] = Element.new('c') #-> <a><c/></a> doc.root.elements['c'] = Element.new('d') #-> <a><d/></a>
Sets an attribute, overwriting any existing attribute value by the same name. Namespace
is significant.
the name of the attribute
(optional) If supplied, the value of the attribute. If nil, any existing matching attribute is deleted.
Owning element
doc = Document.new "<a x:foo='1' foo='3'/>" doc.root.attributes['y:foo'] = '2' doc.root.attributes['foo'] = '4' doc.root.attributes['x:foo'] = nil
Set
an index entry. See Array.[]=
@param index the index of the element to set @param opt either the object to set, or an Integer
length @param child if opt is an Integer
, this is the child to set @return the parent (self)