class Tripod::Fields::Standard

Defines the behaviour for defined fields in the resource.

Attributes

datatype[RW]

Set readers for the instance variables.

is_uri[RW]

Set readers for the instance variables.

is_uri?[RW]

Set readers for the instance variables.

multivalued[RW]

Set readers for the instance variables.

multivalued?[RW]

Set readers for the instance variables.

name[RW]

Set readers for the instance variables.

options[RW]

Set readers for the instance variables.

predicate[RW]

Set readers for the instance variables.

Public Class Methods

new(name, predicate, options = {}) click to toggle source
Create the new field with a name and optional additional options.

@example Create the new field.
  Field.new(:name, 'http://foo', opts)

@param [ String ] name The field name.
@param [ String, RDF::URI ] predicate The field's predicate.
@param [ Hash ] options The field options.

 @option options [ String, RDF::URI ] datatype The uri of the datatype for the field (will be used to create an RDF::Literal of the right type on the way in only).

@option options [ Boolean ] multivalued Is this a multi-valued field? Default is false.
# File lib/tripod/fields/standard.rb, line 22
def initialize(name, predicate, options = {})
  @name = name
  @options = options
  @predicate = RDF::URI.new(predicate.to_s)
  @datatype = RDF::URI.new(options[:datatype].to_s) if options[:datatype]
  @is_uri = !!options[:is_uri]
  @multivalued = options[:multivalued] || false
end