class RoadForest::TypeHandlers::RDFPost::Reader::St::State

Public Class Methods

new(reader) click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 12
def initialize(reader)
  @reader = reader
  @accept_hash = cleanup(accept_list)
end

Public Instance Methods

accept(key, value) click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 74
def accept(key, value)
  #puts "#{[self.class.to_s.sub(/.*:/,''), key,
  #value.sub(/\s*\Z/,'')].inspect}"
  @accept_hash[key][value.sub(/\s*\Z/,'')]
end
base_uri() click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 30
def base_uri
  ::RDF::URI.intern(@reader.options[:base_uri])
end
blank_node(name) click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 26
def blank_node(name)
  ::RDF::Node.new(name)
end
cleanup(accept_list) click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 17
def cleanup(accept_list)
  hash = Hash.new{ accept_list[nil] }
  accept_list.each_key do |key|
    next if key.nil?
    hash[key.to_s] = accept_list[key]
  end
  hash
end
clear_object() click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 52
def clear_object
  @reader.object = nil
  @reader.object_prefix = nil
end
clear_predicate() click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 47
def clear_predicate
  @reader.predicate = nil
  @reader.predicate_prefix = nil
end
clear_subject() click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 42
def clear_subject
  @reader.subject = nil
  @reader.subject_prefix = nil
end
consume() click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 62
def consume
  @reader.consume_pair
end
consume_next(name) click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 57
def consume_next(name)
  consume
  next_state(name)
end
next_state(name) click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 70
def next_state(name)
  @reader.current_state = @reader.states.fetch(name)
end
prefix_uri(name) click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 38
def prefix_uri(name)
  ::RDF::URI.intern(@reader.options[:prefixes][name])
end
triple_complete() click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 66
def triple_complete
  @reader.new_triple = true
end
uri(string) click to toggle source
# File lib/roadforest/type-handlers/rdfpost.rb, line 34
def uri(string)
  base_uri.join(string)
end