Class: Tripod::Fields::Standard
- Inherits:
-
Object
- Object
- Tripod::Fields::Standard
- Defined in:
- lib/tripod/fields/standard.rb
Overview
Defines the behaviour for defined fields in the resource.
Instance Attribute Summary collapse
-
#datatype ⇒ Object
Set readers for the instance variables.
-
#is_uri ⇒ Object
(also: #is_uri?)
Set readers for the instance variables.
-
#multivalued ⇒ Object
(also: #multivalued?)
Set readers for the instance variables.
-
#name ⇒ Object
Set readers for the instance variables.
-
#options ⇒ Object
Set readers for the instance variables.
-
#predicate ⇒ Object
Set readers for the instance variables.
Instance Method Summary collapse
-
#initialize(name, predicate, options = {}) ⇒ Standard
constructor
Create the new field with a name and optional additional options.
Constructor Details
#initialize(name, predicate, options = {}) ⇒ Standard
Create the new field with a name and optional additional 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).
22 23 24 25 26 27 28 29 |
# File 'lib/tripod/fields/standard.rb', line 22 def initialize(name, predicate, = {}) @name = name @options = @predicate = RDF::URI.new(predicate.to_s) @datatype = RDF::URI.new([:datatype].to_s) if [:datatype] @is_uri = !![:is_uri] @multivalued = [:multivalued] || false end |
Instance Attribute Details
#datatype ⇒ Object
Set readers for the instance variables.
7 8 9 |
# File 'lib/tripod/fields/standard.rb', line 7 def datatype @datatype end |
#is_uri ⇒ Object Also known as: is_uri?
Set readers for the instance variables.
7 8 9 |
# File 'lib/tripod/fields/standard.rb', line 7 def is_uri @is_uri end |
#multivalued ⇒ Object Also known as: multivalued?
Set readers for the instance variables.
7 8 9 |
# File 'lib/tripod/fields/standard.rb', line 7 def multivalued @multivalued end |
#name ⇒ Object
Set readers for the instance variables.
7 8 9 |
# File 'lib/tripod/fields/standard.rb', line 7 def name @name end |
#options ⇒ Object
Set readers for the instance variables.
7 8 9 |
# File 'lib/tripod/fields/standard.rb', line 7 def @options end |
#predicate ⇒ Object
Set readers for the instance variables.
7 8 9 |
# File 'lib/tripod/fields/standard.rb', line 7 def predicate @predicate end |