class SchemaRD::Metadata::Parser
parser for metadata yaml
Public Class Methods
deep_merge(source, other)
click to toggle source
# File lib/schemard/metadata.rb, line 127 def self.deep_merge(source, other) other.each do |k,v| next self.deep_merge(source[k], other[k]) if other[k].is_a?(Hash) && source[k].is_a?(Hash) source[k] = other[k] end end
new(output_file, *metadata_files)
click to toggle source
# File lib/schemard/metadata.rb, line 116 def initialize(output_file, *metadata_files) @parsed = {} metadata_files.select{|metadata_file| File.exist?(metadata_file) }.each do |metadata_file| self.class.deep_merge(@parsed, YAML.load_file(metadata_file)) end self.class.deep_merge(@parsed, YAML.load_file(output_file)) if File.exist?(output_file) end
Public Instance Methods
parse()
click to toggle source
get hash of metadata
# File lib/schemard/metadata.rb, line 124 def parse @parsed end