- Parent Namespace
- Plumbum::Providers
- Included Modules
- Plumbum::Provider
- Defined In
- lib/plumbum/providers/singular.rb
Table Of Contents
Overview
Provider implementation that wraps a single key-value pair.
Back To Top
Instance Attributes
#key => String (readonly)
Returns
- (String) — the key matched by the provider.
#value => Object (readonly)
Returns
- (Object) — the value returned by the provider.
Back To Top
Instance Methods
#get(key) => Object, nil
- Inherited From
- Plumbum::Provider
Retrieves the provided value for the given key.
Parameters
- key (String, Symbol) — the key for the requested value.
Returns
- (Object, nil) — the requested object, or nil if the provider does
not have a value for the requested key.
#has?(key, allow_undefined: false) => true, false
- Inherited From
- Plumbum::Provider
Checks if the provider has a value for the given key.
Parameters
- key (String, Symbol) — the key for the requested value.
- allow_undefined (true, false) — if true, returns true even if the key
exists but the value is undefined.
Returns
- (true, false) — true if the provider has a value for the requested
key, otherwise false.
#options => Hash{Symbol => Object}
- Inherited From
- Plumbum::Provider
Returns
- (Hash{Symbol => Object}) — the options used to configure the
provider.
#read_only? => true, false
- Inherited From
- Plumbum::Provider
Returns
- (true, false) — if true, indicates the provider is read only, and an
exception will be raised when attempting to set or change its value(s).
#set(key, value) => Object
- Inherited From
- Plumbum::Provider
Sets the value for the given key.
Parameters
- key (String, Symbol) — the key for the assigned value.
- value (Object) — the value to assign.
Returns
- (Object) — the assigned value.
Raises
#write_once? => true, false
- Inherited From
- Plumbum::Provider
Returns
- (true, false) — if true, indicates the provider permits overwriting
undefined values, and an exception will be raised when attemption to
set or change any other values.
Back To Top
Back to
Documentation |
Reference
|
Plumbum
|
Plumbum::Providers