class RDF::AllegroGraph::SnaGenerator

Internal helper class for defining SNA generators.

@private

Attributes

options[R]

Public Class Methods

new(repository, options) click to toggle source
# File lib/rdf/allegro_graph/sna_generator.rb, line 8
def initialize(repository, options)
  @repository = repository
  @options = options
end

Public Instance Methods

to_params() click to toggle source
# File lib/rdf/allegro_graph/sna_generator.rb, line 13
def to_params
  params = {}
  params.merge!(option_to_hash(:objectOf, :object_of))
  params.merge!(option_to_hash(:subjectOf, :subject_of))
  params.merge!(option_to_hash(:undirected, :undirected))
  params
end

Protected Instance Methods

option_to_hash(param_name, option_name) click to toggle source
# File lib/rdf/allegro_graph/sna_generator.rb, line 23
def option_to_hash(param_name, option_name)
  if @options.has_key?(option_name)
    value = @options[option_name]
    case value
    when Array
      { param_name => value.map {|v| @repository.serialize(v) } }
    else
      { param_name => @repository.serialize(value) }
    end
  else
    {}
  end
end