Class: RDFObject::Index
- Inherits:
-
Object
- Object
- RDFObject::Index
- Defined in:
- lib/rdf_objects/pho/index_set.rb
Instance Attribute Summary collapse
-
#analyzer ⇒ Object
readonly
Returns the value of attribute analyzer.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#property ⇒ Object
readonly
Returns the value of attribute property.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Index
constructor
A new instance of Index.
- #set_analyzer(analyzer) ⇒ Object
- #set_name(name) ⇒ Object
- #set_property(property) ⇒ Object
- #set_weight(boost) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Index
Returns a new instance of Index.
4 5 6 7 8 9 10 11 12 |
# File 'lib/rdf_objects/pho/index_set.rb', line 4 def initialize(args={}) unless args.empty? ["name","property","analyzer","weight"].each do |prop| if args[prop] || args[prop.to_s] self.send("set_prop".to_sym, (args[prop] || args[prop.to_s])) end end end end |
Instance Attribute Details
#analyzer ⇒ Object (readonly)
Returns the value of attribute analyzer.
3 4 5 |
# File 'lib/rdf_objects/pho/index_set.rb', line 3 def analyzer @analyzer end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/rdf_objects/pho/index_set.rb', line 3 def name @name end |
#property ⇒ Object (readonly)
Returns the value of attribute property.
3 4 5 |
# File 'lib/rdf_objects/pho/index_set.rb', line 3 def property @property end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
3 4 5 |
# File 'lib/rdf_objects/pho/index_set.rb', line 3 def weight @weight end |
Instance Method Details
#set_analyzer(analyzer) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rdf_objects/pho/index_set.rb', line 26 def set_analyzer(analyzer) if analyzer.is_a?(RDFObject::Resource) @analyzer = analyzer else unless analyzer =~ /^http:\/\// analyzer = "http://schemas.talis.com/2007/bigfoot/analyzers#analyzer" end @analyzer = RDFObject::Resource.new(analyzer) end end |
#set_name(name) ⇒ Object
14 15 16 |
# File 'lib/rdf_objects/pho/index_set.rb', line 14 def set_name(name) @name = name end |
#set_property(property) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/rdf_objects/pho/index_set.rb', line 18 def set_property(property) if property.is_a?(RDFObject::Resource) @property = property else @property = RDFObject::Resource.new(property) end end |
#set_weight(boost) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/rdf_objects/pho/index_set.rb', line 37 def set_weight(boost) unless boost.nil? @weight = boost.to_f else @weight = nil end end |