class Hyrax::Ingest::Fetcher::YAMLFile

Attributes

filename[R]
yaml_path[R]

Public Class Methods

new(options={}) click to toggle source
Calls superclass method Hyrax::Ingest::Fetcher::Base::new
# File lib/hyrax/ingest/fetcher/yaml_file.rb, line 15
def initialize(options={})
  raise ArgumentError, "Required option :filename is missing" unless options.key?(:filename)
  raise ArgumentError, "Required option :yaml_path is missing" unless options.key?(:yaml_path)
  @filename = options[:filename]
  @yaml_path = options[:yaml_path]
  super
end

Public Instance Methods

fetch() click to toggle source
# File lib/hyrax/ingest/fetcher/yaml_file.rb, line 23
def fetch
  @fetched_value ||= yaml.dig(*yaml_path)
end

Private Instance Methods

yaml() click to toggle source

@return [Hash, Array, String] The YAML parsed into Ruby objects.

# File lib/hyrax/ingest/fetcher/yaml_file.rb, line 30
def yaml
  @yaml ||= YAML.load sip.read_file(filename)
end