class Worthwhile::Configuration

Attributes

application_root_url[W]

Configure the application root url.

build_identifier[W]

When was this last built/deployed

characterization_runner[RW]

Override characterization runner

default_antivirus_instance[W]

An anonymous function that receives a path to a file and returns AntiVirusScanner::NO_VIRUS_FOUND_RETURN_VALUE if no virus is found; Any other returned value means a virus was found

search_config[W]

Configure default search options from config/search_config.yml

Public Instance Methods

application_root_url() click to toggle source
# File lib/worthwhile/configuration.rb, line 31
def application_root_url
  @application_root_url || (raise RuntimeError.new("Make sure to set your Worthwhile.configuration.application_root_url"))
end
build_identifier() click to toggle source
# File lib/worthwhile/configuration.rb, line 37
def build_identifier
  # If you restart the server, this could be out of sync; A better
  # implementation is to read something from the file system. However
  # that detail is an exercise for the developer.
  @build_identifier ||= Time.now.strftime("%Y-%m-%d %H:%M:%S")
end
curation_concerns() click to toggle source

Returns the classes of the registered curation concerns

# File lib/worthwhile/configuration.rb, line 62
def curation_concerns
  registered_curation_concern_types.map(&:constantize)
end
default_antivirus_instance() click to toggle source
# File lib/worthwhile/configuration.rb, line 17
def default_antivirus_instance
  @default_antivirus_instance ||= lambda {|file_path|
    AntiVirusScanner::NO_VIRUS_FOUND_RETURN_VALUE
  }
end
register_curation_concern(*curation_concern_types) click to toggle source
# File lib/worthwhile/configuration.rb, line 47
def register_curation_concern(*curation_concern_types)
  Array(curation_concern_types).flatten.compact.each do |cc_type|
    class_name = normalize_concern_name(cc_type)
    if ! registered_curation_concern_types.include?(class_name)
      self.registered_curation_concern_types << class_name
    end
  end
end
registered_curation_concern_types() click to toggle source

Returns the class names (strings) of the registered curation concerns

# File lib/worthwhile/configuration.rb, line 57
def registered_curation_concern_types
  @registered_curation_concern_types ||= []
end
search_config() click to toggle source
# File lib/worthwhile/configuration.rb, line 25
def search_config
  @search_config ||= "search_config not set"
end

Private Instance Methods

normalize_concern_name(c) click to toggle source
# File lib/worthwhile/configuration.rb, line 68
def normalize_concern_name(c)
  c.to_s.camelize
end