Class: ActiveTriples::NodeConfig
- Inherits:
-
Object
- Object
- ActiveTriples::NodeConfig
- Defined in:
- lib/active_triples/node_config.rb
Overview
Configuration for properties
Defined Under Namespace
Classes: IndexObject
Instance Attribute Summary collapse
- #behaviors ⇒ Enumerator<Symbol>
- #cast ⇒ Boolean
- #class_name ⇒ Class, String
- #predicate ⇒ RDF::URI
- #term ⇒ Symbol
- #type ⇒ Symbol
Instance Method Summary collapse
-
#[](value) ⇒ Object
The attribute or option represented by the symbol.
-
#initialize(term, predicate, opts = {}) {|config| ... } ⇒ NodeConfig
constructor
A new instance of NodeConfig.
- #with_index {|index| ... } ⇒ Object
Constructor Details
#initialize(term, predicate, opts = {}) {|config| ... } ⇒ NodeConfig
Returns a new instance of NodeConfig.
31 32 33 34 35 36 37 38 |
# 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 |
Instance Attribute Details
#behaviors ⇒ Enumerator<Symbol>
20 |
# File 'lib/active_triples/node_config.rb', line 20 attr_accessor :predicate, :term, :class_name, :type, :behaviors, :cast |
#cast ⇒ Boolean
20 |
# File 'lib/active_triples/node_config.rb', line 20 attr_accessor :predicate, :term, :class_name, :type, :behaviors, :cast |
#class_name ⇒ Class, String
20 |
# File 'lib/active_triples/node_config.rb', line 20 attr_accessor :predicate, :term, :class_name, :type, :behaviors, :cast |
#predicate ⇒ RDF::URI
20 21 22 |
# File 'lib/active_triples/node_config.rb', line 20 def predicate @predicate end |
#term ⇒ Symbol
20 |
# File 'lib/active_triples/node_config.rb', line 20 attr_accessor :predicate, :term, :class_name, :type, :behaviors, :cast |
#type ⇒ Symbol
20 |
# File 'lib/active_triples/node_config.rb', line 20 attr_accessor :predicate, :term, :class_name, :type, :behaviors, :cast |
Instance Method Details
#[](value) ⇒ Object
Returns the attribute or option represented by the symbol.
43 44 45 46 |
# 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 {|index| ... } ⇒ Object
64 65 66 67 68 69 70 |
# 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 |