class MaybeGraphResult
Encapsulates how to handle turning a Hurley result into an RDF::Graph.
Attributes
result[R]
Public Class Methods
new(result)
click to toggle source
@param [Hurley::Response] result A web response object.
# File lib/marmotta/maybe_graph_result.rb, line 7 def initialize(result) @result = result end
Public Instance Methods
value()
click to toggle source
# File lib/marmotta/maybe_graph_result.rb, line 11 def value if graph? parsed_graph else RDF::Graph.new end end
Private Instance Methods
graph?()
click to toggle source
# File lib/marmotta/maybe_graph_result.rb, line 21 def graph? result.success? end
parsed_graph()
click to toggle source
# File lib/marmotta/maybe_graph_result.rb, line 25 def parsed_graph JSON::LD::Reader.new(result.body) end