Class: ActiveTriples::NodeConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/active_triples/node_config.rb

Defined Under Namespace

Classes: IndexObject

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(term, predicate, args = {}) {|_self| ... } ⇒ NodeConfig

Returns a new instance of NodeConfig.

Yields:

  • (_self)

Yield Parameters:



6
7
8
9
10
11
12
13
# File 'lib/active_triples/node_config.rb', line 6

def initialize(term, predicate, args={})
  self.term = term
  self.predicate = predicate
  self.class_name = args.delete(:class_name) { default_class_name }
  self.cast = args.delete(:cast) { true }
  @opts = args
  yield(self) if block_given?
end

Instance Attribute Details

#behaviorsObject

Returns the value of attribute behaviors.



4
5
6
# File 'lib/active_triples/node_config.rb', line 4

def behaviors
  @behaviors
end

#castObject

Returns the value of attribute cast.



4
5
6
# File 'lib/active_triples/node_config.rb', line 4

def cast
  @cast
end

#class_nameObject

Returns the value of attribute class_name.



4
5
6
# File 'lib/active_triples/node_config.rb', line 4

def class_name
  @class_name
end

#predicateObject

Returns the value of attribute predicate.



4
5
6
# File 'lib/active_triples/node_config.rb', line 4

def predicate
  @predicate
end

#termObject

Returns the value of attribute term.



4
5
6
# File 'lib/active_triples/node_config.rb', line 4

def term
  @term
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/active_triples/node_config.rb', line 4

def type
  @type
end

Instance Method Details

#[](value) ⇒ Object



15
16
17
18
# File 'lib/active_triples/node_config.rb', line 15

def [](value)
  value = value.to_sym
  self.respond_to?(value) ? self.send(value) : @opts[value]
end

#with_index {|iobj| ... } ⇒ Object

Yields:

  • (iobj)


33
34
35
36
37
38
39
# File 'lib/active_triples/node_config.rb', line 33

def with_index (&block)
  # needed for solrizer integration
  iobj = IndexObject.new
  yield iobj
  self.type = iobj.data_type
  self.behaviors = iobj.behaviors
end