Module: Redstruct
- Defined in:
- lib/redstruct.rb,
lib/redstruct/error.rb,
lib/redstruct/factory.rb,
lib/redstruct/version.rb,
lib/redstruct/hls/lock.rb,
lib/redstruct/hls/queue.rb,
lib/redstruct/types/set.rb,
lib/redstruct/connection.rb,
lib/redstruct/types/base.rb,
lib/redstruct/types/hash.rb,
lib/redstruct/types/list.rb,
lib/redstruct/types/script.rb,
lib/redstruct/types/string.rb,
lib/redstruct/types/struct.rb,
lib/redstruct/configuration.rb,
lib/redstruct/types/counter.rb,
lib/redstruct/utils/coercion.rb,
lib/redstruct/factory/creation.rb,
lib/redstruct/types/sorted_set.rb,
lib/redstruct/utils/scriptable.rb,
lib/redstruct/utils/inspectable.rb,
lib/redstruct/yard/defscript_handler.rb,
lib/redstruct/factory/deserialization.rb
Defined Under Namespace
Modules: Hls, Types, Utils
Classes: Configuration, Connection, DefscriptHandler, Error, Factory
Constant Summary
collapse
- VERSION =
'0.1.1'.freeze
Class Method Summary
collapse
Class Method Details
.[](key) ⇒ Object
42
43
44
45
46
47
|
# File 'lib/redstruct.rb', line 42
def [](key)
factory = factories[key]
factory = make(name: key) if factory.nil?
return factory
end
|
.[]=(key, factory) ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/redstruct.rb', line 49
def []=(key, factory)
if factory.nil?
factories.delete(key)
else
factories[key] = factory
end
end
|
.config ⇒ Object
34
35
36
|
# File 'lib/redstruct.rb', line 34
def config
return @config ||= Configuration.new
end
|
.factories ⇒ Object
38
39
40
|
# File 'lib/redstruct.rb', line 38
def factories
return @factories ||= {}
end
|
.make(name: nil, pool: nil, namespace: nil) ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/redstruct.rb', line 57
def make(name: nil, pool: nil, namespace: nil)
factory = Redstruct::Factory.new(pool: pool, namespace: namespace)
name = Redstruct if name.nil?
self[name] = factory unless name.nil?
return factory
end
|