lib/geo_combine.rb in geo_combine-0.5.1 vs lib/geo_combine.rb in geo_combine-0.6.0
- old
+ new
@@ -1,12 +1,13 @@
+# frozen_string_literal: true
+
require 'nokogiri'
require 'json'
require 'json-schema'
require 'sanitize'
module GeoCombine
-
##
# TODO: Create a parse method that can interpret the type of metadata being
# passed in.
#
# def self.parse metadata
@@ -21,11 +22,11 @@
# Creates a new GeoCombine::Metadata object, where metadata parameter is can
# be a File path or String of XML
# @param [String] metadata can be a File path
# "./tmp/edu.stanford.purl/bb/338/jh/0716/iso19139.xml" or a String of XML
# metadata
- def initialize metadata
+ def initialize(metadata)
metadata = File.read metadata if File.readable? metadata
metadata = Nokogiri::XML(metadata) if metadata.instance_of? String
@metadata = metadata
end
@@ -33,10 +34,10 @@
# Perform an XSLT tranformation on metadata using an object's XSL
# @return fields additional GeoBlacklight fields to be passed to
# GeoCombine::Geoblacklight on its instantiation
# @return [GeoCombine::Geoblacklight] the data transformed into
# geoblacklight schema, returned as a GeoCombine::Geoblacklight
- def to_geoblacklight fields = {}
+ def to_geoblacklight(fields = {})
GeoCombine::Geoblacklight.new(xsl_geoblacklight.apply_to(@metadata), fields)
end
##
# Perform an XSLT transformation to HTML using an object's XSL