Sha256: 8716d55403619a0c021533c2a012ed775a73801be6db29ed4e3aece08474ddf8
Contents?: true
Size: 815 Bytes
Versions: 29
Compression:
Stored size: 815 Bytes
Contents
# frozen-string-literal: true module Mobility module Plugins =begin Defines convenience methods for accessing backends, of the form "<name>_backend". The format for this method can be customized by passing a different format string as the plugin option. =end module BackendReader extend Plugin default true requires :backend initialize_hook do |*names| if backend_reader = options[:backend_reader] backend_reader = "%s_backend" if backend_reader == true names.each do |name| module_eval <<-EOM, __FILE__, __LINE__ + 1 def #{backend_reader % name} mobility_backends[:#{name}] end EOM end end end end register_plugin(:backend_reader, BackendReader) end end
Version data entries
29 entries across 29 versions & 1 rubygems