Class: Fedora2To3PidRenamer::Config
- Inherits:
-
Object
- Object
- Fedora2To3PidRenamer::Config
- Defined in:
- lib/fedora_2_to_3_pid_renamer/config.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
- #change_for(original) ⇒ Object
- #changeme_replacement ⇒ Object
- #changes ⇒ Object
- #folders ⇒ Object
-
#initialize(source) ⇒ Config
constructor
A new instance of Config.
- #input_folder ⇒ Object
- #locations ⇒ Object
- #namespaces ⇒ Object
- #output_folder ⇒ Object
- #path_relative_to_working_directory(folder) ⇒ Object
- #yaml ⇒ Object
Constructor Details
#initialize(source) ⇒ Config
Returns a new instance of Config.
14 15 16 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 14 def initialize(source) @source = source end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
8 9 10 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 8 def source @source end |
Class Method Details
.load(path) ⇒ Object
10 11 12 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 10 def self.load(path) new File.read(path) end |
Instance Method Details
#change_for(original) ⇒ Object
34 35 36 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 34 def change_for(original) changes[original] end |
#changeme_replacement ⇒ Object
38 39 40 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 38 def changeme_replacement yaml['changeme'] end |
#changes ⇒ Object
26 27 28 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 26 def changes @changes ||= yaml['changes'] end |
#folders ⇒ Object
30 31 32 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 30 def folders yaml['folders'] end |
#input_folder ⇒ Object
42 43 44 45 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 42 def input_folder return unless folders @input_folder ||= path_relative_to_working_directory folders['input'] end |
#locations ⇒ Object
22 23 24 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 22 def locations @locations ||= yaml['locations'] end |
#namespaces ⇒ Object
18 19 20 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 18 def namespaces @namespaces ||= yaml['namespaces'] end |
#output_folder ⇒ Object
47 48 49 50 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 47 def output_folder return unless folders @output_folder ||= path_relative_to_working_directory folders['output'] end |
#path_relative_to_working_directory(folder) ⇒ Object
56 57 58 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 56 def path_relative_to_working_directory(folder) File. folder, Dir.pwd end |
#yaml ⇒ Object
52 53 54 |
# File 'lib/fedora_2_to_3_pid_renamer/config.rb', line 52 def yaml @yaml ||= YAML.load(source) end |