Sha256: 21bc3fcab4ac4548792e09cc0185b228b412b43f5c66c24d8be8208751d7c895

Contents?: true

Size: 599 Bytes

Versions: 6

Compression:

Stored size: 599 Bytes

Contents

module RDF
  ##
  # An RDF resource.
  module Resource
    include RDF::Value

    ##
    # Instantiates an {RDF::Node} or an {RDF::URI}, depending on the given
    # argument.
    #
    # @return [RDF::Resource]
    def self.new(*args, &block)
      case arg = args.shift
        when Symbol     then Node.intern(arg, *args, &block)
        when /^_:(.*)$/ then Node.new($1, *args, &block)
        else URI.new(arg, *args, &block)
      end
    end

    ##
    # Returns `true` to indicate that this value is a resource.
    #
    # @return [Boolean]
    def resource?
      true
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rdf-0.3.0.pre lib/rdf/model/resource.rb
rdf-0.2.3 lib/rdf/model/resource.rb
rdf-0.2.2 lib/rdf/model/resource.rb
rdf-0.2.1 lib/rdf/model/resource.rb
rdf-0.2.0.1 lib/rdf/model/resource.rb
rdf-0.2.0 lib/rdf/model/resource.rb