Module: Readthis

Defined in:
lib/readthis.rb,
lib/readthis/cache.rb,
lib/readthis/entity.rb,
lib/readthis/errors.rb,
lib/readthis/scripts.rb,
lib/readthis/version.rb,
lib/readthis/expanders.rb,
lib/readthis/passthrough.rb,
lib/readthis/serializers.rb

Defined Under Namespace

Modules: Expanders, Passthrough Classes: Cache, Entity, Scripts, Serializers

Constant Summary collapse

ReadthisError =

This is the base error that all other specific errors inherit from, making it possible to rescue the ‘ReadthisError` superclass.

This isn’t raised by itself.

Class.new(StandardError)
SerializersFrozenError =

Raised when attempting to modify the serializers after they have been frozen.

Class.new(ReadthisError)
SerializersLimitError =

Raised when attempting to add a new serializer after the limit of 7 is reached.

Class.new(ReadthisError)
UnknownCommandError =

Raised when an unknown script is called.

Class.new(ReadthisError)
UnknownSerializerError =

Raised when a serializer was specified, but hasn’t been configured for usage.

Class.new(ReadthisError)
VERSION =
'2.2.0'

Class Method Summary collapse

Class Method Details

.fault_tolerant=(value) ⇒ Object

Toggle fault tolerance for connection errors.

Parameters:

  • value (Boolean)

    The new value for fault tolerance



33
34
35
# File 'lib/readthis.rb', line 33

def fault_tolerant=(value)
  @fault_tolerant = value
end

.fault_tolerant?Boolean

Indicates whether connection error tolerance is enabled. With tolerance enabled every operation will return a ‘nil` value.

Returns:

  • (Boolean)

    True for enabled, false for disabled



25
26
27
# File 'lib/readthis.rb', line 25

def fault_tolerant?
  @fault_tolerant
end

.reset!Object



38
39
40
41
# File 'lib/readthis.rb', line 38

def reset!
  @fault_tolerant = nil
  @serializers = nil
end

.serializersReadthis::Serializers

The current, global, instance of serializers that is used by all cache instances.

Returns:

See Also:

  • readthis/serializers


16
17
18
# File 'lib/readthis.rb', line 16

def serializers
  @serializers ||= Readthis::Serializers.new
end