class ActiveTriples::Property

A value object to encapsulate what a Property is. Instantiate with a hash of options.

@example configuring a property in a schema

title_prop = ActiveTriples::Property.new(name:     :title,
                                         predicate: RDF::Vocab::DC.title)

Attributes

attributes[RW]
config[RW]

@!attribute [r] name

@return [Symbol]

@!attribute [r] config

@return [Proc]
name[RW]

@!attribute [r] name

@return [Symbol]

@!attribute [r] config

@return [Proc]
to_h[RW]

Public Class Methods

new(options = {}, &block) click to toggle source

@param options [Hash] Options for the property @option options [RDF::URI] :name @option options [Boolean] :cast @option options [String, Class] :class_name @option options [RDF::URI] :predicate

# File lib/active_triples/property.rb, line 17
def initialize(options = {}, &block)
  self.name       = options.fetch(:name)
  self.attributes = options.except(:name)
  self.config     = block 
end

Public Instance Methods

cast() click to toggle source

@return [Boolean]

# File lib/active_triples/property.rb, line 32
def cast
  attributes.fetch(:cast, false)
end
class_name() click to toggle source

@return [Class]

# File lib/active_triples/property.rb, line 38
def class_name
  attributes[:class_name]
end
predicate() click to toggle source

@return [RDF::Vocabulary::Term]

# File lib/active_triples/property.rb, line 44
def predicate
  attributes[:predicate]
end