Module: Votd

Defined in:
lib/votd.rb,
lib/votd/cli.rb,
lib/votd/base.rb,
lib/votd/version.rb,
lib/votd/esvbible.rb,
lib/votd/netbible.rb,
lib/votd/ourmanna.rb,
lib/votd/votd_error.rb,
lib/votd/fetch_error.rb,
lib/votd/helper/text.rb,
lib/votd/bible_gateway.rb,
lib/votd/helper/command_line.rb

Overview

This class acts as the entry point to all sub-modules that are used to interact with various Verse of the Day web services.

Defined Under Namespace

Modules: Helper Classes: Base, BibleGateway, CLI, ESVBible, FetchError, InvalidBibleVersion, NetBible, OurManna, VotdError

Constant Summary collapse

VERSION =

Gem version number

"4.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject

Set a Logger-compatible object to receive error messages when a provider fails to fetch a verse.

Examples:

Votd.logger = Logger.new($stderr)


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

def logger
  @logger
end

Class Method Details

.on_error {|provider_class, error| ... } ⇒ void

This method returns an undefined value.

Register a callback to be invoked when a provider error occurs. The block receives the provider class and the wrapped FetchError.

Examples:

Votd.on_error do |provider_class, error|
  Sentry.capture_exception(error)
end

Yields:

  • (provider_class, error)

    invoked when a provider fails

Yield Parameters:

  • provider_class (Class)

    the provider class that failed (e.g. Votd::BibleGateway)

  • error (FetchError)

    the wrapped exception



30
31
32
# File 'lib/votd.rb', line 30

def on_error(&block)
  @on_error = block
end

.on_error_callbackProc?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the registered on_error callback, if any.

Returns:

  • (Proc, nil)


37
38
39
# File 'lib/votd.rb', line 37

def on_error_callback
  @on_error
end

.reset_configurationvoid

This method returns an undefined value.

Resets logger and on_error callback. Useful in tests.



43
44
45
46
# File 'lib/votd.rb', line 43

def reset_configuration
  @logger = nil
  @on_error = nil
end