Module: Tripod::Fields::ClassMethods
- Defined in:
- lib/tripod/fields.rb
Instance Method Summary collapse
-
#field(name, predicate, options = {}) ⇒ Field
Defines all the fields that are accessible on the Resource For each field that is defined, a getter and setter will be added as an instance method to the Resource.
-
#get_field(name) ⇒ Object
Return the field object on a
Resource
associated with the given name.
Instance Method Details
#field(name, predicate, options = {}) ⇒ Field
Defines all the fields that are accessible on the Resource For each field that is defined, a getter and setter will be added as an instance method to the Resource.
@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).
39 40 41 42 |
# File 'lib/tripod/fields.rb', line 39 def field(name, predicate, = {}) # TODO: validate the field params/options here.. add_field(name, predicate, ) end |
#get_field(name) ⇒ Object
Return the field object on a Resource
associated with the given name.
50 51 52 53 54 |
# File 'lib/tripod/fields.rb', line 50 def get_field(name) field = self.fields[name] raise Tripod::Errors::FieldNotPresent.new unless field field end |