lib/rdf/vocab/extensions.rb in rdf-vocab-3.1.14 vs lib/rdf/vocab/extensions.rb in rdf-vocab-3.2.0
- old
+ new
@@ -21,11 +21,11 @@
# Ruby's autoloading facility, meaning that `@@subclasses` will be
# empty until each subclass has been touched or require'd.
RDF::Vocab::VOCABS.each do |n, params|
clsname = params[:class_name].to_sym
RDF::Vocab.const_get(clsname) # Forces class to load
- end unless @classes_loaded
+ end unless instance_variable_defined?(:@classes_loaded) && @classes_loaded
@classes_loaded = true
end
_orig_each(&block)
end
@@ -38,16 +38,16 @@
def vocab_map
@vocab_map ||= RDF::VOCABS.transform_values(&:freeze).merge(
RDF::Vocab::VOCABS.transform_values(&:freeze))
end
+ alias_method :_orig_from_sym, :from_sym
##
# Return the vocabulary based on it's class_name symbol
#
# @param [Symbol] sym
# @return [RDF::Vocabulary]
- alias_method :_orig_from_sym, :from_sym
def from_sym(sym)
RDF::Vocab.const_defined?(sym.to_sym) ?
RDF::Vocab.const_get(sym.to_sym) : _orig_from_sym(sym)
end
@@ -88,12 +88,12 @@
end
##
# Generate Turtle representation, specific to vocabularies
#
- # @param [RDF::Queryable] :graph Optional graph, otherwise uses statements from vocabulary.
- # @param [Hash{#to_sym => String}] Prefixes to add to output
+ # @param [RDF::Queryable] graph Optional graph, otherwise uses statements from vocabulary.
+ # @param [Hash{#to_sym => String}] prefixes to add to output
# @return [String]
def to_ttl(graph: nil, prefixes: nil)
require 'rdf/turtle'
output = []
@@ -168,11 +168,11 @@
end
##
# Generate JSON-LD representation, specific to vocabularies
#
- # @param [RDF::Queryable] :graph Optional graph, otherwise uses statements from vocabulary.
- # @param [Hash{#to_sym => String}] Prefixes to add to output
+ # @param [RDF::Queryable] graph Optional graph, otherwise uses statements from vocabulary.
+ # @param [Hash{#to_sym => String}] prefixes to add to output
# @return [String]
def to_jsonld(graph: nil, prefixes: nil)
require 'json/ld'
context = {}