Module: Middleman::Ontologist::Utilities

Defined in:
lib/ontologist/ontology.rb

Instance Method Summary collapse

Instance Method Details

#convert_predicate(predicate) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/ontologist/ontology.rb', line 18

def convert_predicate(predicate)

  unless predicate.is_a? RDF::URI
    predicate = RDF::URI.new(resolve_key(predicate))
  end

  predicate # return it

end

#valid_url?(url) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
# File 'lib/ontologist/ontology.rb', line 11

def valid_url?(url)
  parsed = Addressable::URI.parse(url) or return false
  %w(http https).include?(parsed.scheme)
rescue Addressable::URI::InvalidURIError
  false
end