Class: Hyrax::Ingest::Fetcher::YAMLFile

Inherits:
Base
  • Object
show all
Includes:
HasSIP
Defined in:
lib/hyrax/ingest/fetcher/yaml_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HasSIP

#sip, #sip=

Methods inherited from Base

#required?

Methods included from HasLogger

config, #logger, #logger=

Methods included from HasReport

#report, #report=

Constructor Details

#initialize(options = {}) ⇒ YAMLFile

Returns a new instance of YAMLFile.

Raises:

  • (ArgumentError)


15
16
17
18
19
20
21
# 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

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



13
14
15
# File 'lib/hyrax/ingest/fetcher/yaml_file.rb', line 13

def filename
  @filename
end

#yaml_pathObject (readonly)

Returns the value of attribute yaml_path.



13
14
15
# File 'lib/hyrax/ingest/fetcher/yaml_file.rb', line 13

def yaml_path
  @yaml_path
end

Instance Method Details

#fetchObject



23
24
25
# File 'lib/hyrax/ingest/fetcher/yaml_file.rb', line 23

def fetch
  @fetched_value ||= yaml.dig(*yaml_path)
end