class ActiveTriples::NodeConfig

Configuration for properties

Attributes

behaviors[RW]

@!attribute class_name [rw]

@return [Class, String]

@!attribute predicate [rw]

@return [RDF::URI]

@!attribute term [rw]

@return [Symbol]

@!attribute type [rw]

@return [Symbol]

@!attribute behaviors [rw]

@return [Enumerator<Symbol>]

@!attribute cast [rw]

@return [Boolean]
cast[RW]

@!attribute class_name [rw]

@return [Class, String]

@!attribute predicate [rw]

@return [RDF::URI]

@!attribute term [rw]

@return [Symbol]

@!attribute type [rw]

@return [Symbol]

@!attribute behaviors [rw]

@return [Enumerator<Symbol>]

@!attribute cast [rw]

@return [Boolean]
class_name[RW]

@!attribute class_name [rw]

@return [Class, String]

@!attribute predicate [rw]

@return [RDF::URI]

@!attribute term [rw]

@return [Symbol]

@!attribute type [rw]

@return [Symbol]

@!attribute behaviors [rw]

@return [Enumerator<Symbol>]

@!attribute cast [rw]

@return [Boolean]
predicate[RW]

@!attribute class_name [rw]

@return [Class, String]

@!attribute predicate [rw]

@return [RDF::URI]

@!attribute term [rw]

@return [Symbol]

@!attribute type [rw]

@return [Symbol]

@!attribute behaviors [rw]

@return [Enumerator<Symbol>]

@!attribute cast [rw]

@return [Boolean]
term[RW]

@!attribute class_name [rw]

@return [Class, String]

@!attribute predicate [rw]

@return [RDF::URI]

@!attribute term [rw]

@return [Symbol]

@!attribute type [rw]

@return [Symbol]

@!attribute behaviors [rw]

@return [Enumerator<Symbol>]

@!attribute cast [rw]

@return [Boolean]
type[RW]

@!attribute class_name [rw]

@return [Class, String]

@!attribute predicate [rw]

@return [RDF::URI]

@!attribute term [rw]

@return [Symbol]

@!attribute type [rw]

@return [Symbol]

@!attribute behaviors [rw]

@return [Enumerator<Symbol>]

@!attribute cast [rw]

@return [Boolean]

Public Class Methods

new(term, predicate, opts={}) { |self| ... } click to toggle source

@param term [Symbol] @param predicate [RDF::URI] @param opts [Hash<Symbol, Object>] @option opts [String, Class] :class_name @option opts [String, Class] :class_name

@yield yields self to the block @yieldparam config [NodeConfig] self

# File lib/active_triples/node_config.rb, line 31
def initialize(term, predicate, opts={})
  self.term = term
  self.predicate = predicate
  self.class_name = opts.delete(:class_name) { nil }
  self.cast = opts.delete(:cast) { true }
  @opts = opts
  yield(self) if block_given?
end

Public Instance Methods

[](value) click to toggle source

@param value [#to_sym] @return [Object] the attribute or option represented by the symbol

# File lib/active_triples/node_config.rb, line 43
def [](value)
  value = value.to_sym
  self.respond_to?(value) ? self.public_send(value) : @opts[value]
end
with_index() { |iobj| ... } click to toggle source

@yield yields an index configuration object @yieldparam index [NodeConfig::IndexObject]

# File lib/active_triples/node_config.rb, line 64
def with_index(&block)
  # needed for solrizer integration
  iobj = IndexObject.new
  yield iobj
  self.type = iobj.data_type
  self.behaviors = iobj.behaviors
end

Private Instance Methods

default_class_name() click to toggle source

@deprecated Use ‘nil` instead.

# File lib/active_triples/node_config.rb, line 76
def default_class_name
    warn 'DEPRECATION: `ActiveTriples::NodeConfig#default_class_name` ' \
         'will be removed in 1.0. Use `nil`.'
  nil
end