Class: XMLPipe2::IndexBuilder
- Inherits:
-
Object
- Object
- XMLPipe2::IndexBuilder
- Defined in:
- lib/xml_pipe2/index_builder.rb
Instance Attribute Summary collapse
-
#clazz ⇒ Object
readonly
Returns the value of attribute clazz.
-
#sphinx_conf ⇒ Object
readonly
Returns the value of attribute sphinx_conf.
-
#xml_schema ⇒ Object
readonly
Returns the value of attribute xml_schema.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(clazz) ⇒ IndexBuilder
constructor
A new instance of IndexBuilder.
Constructor Details
#initialize(clazz) ⇒ IndexBuilder
Returns a new instance of IndexBuilder.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/xml_pipe2/index_builder.rb', line 5 def initialize clazz @clazz = clazz @xml_schema = Tempfile.new('xml_schema.xml') @xml_schema.write(clazz.xml_schema) @xml_schema.close @sphinx_conf = Tempfile.new('sphinx.conf') xml_stream_path = @xml_schema.path @sphinx_conf.write(ERB.new(clazz.sphinx_conf).result(binding)) @sphinx_conf.close end |
Instance Attribute Details
#clazz ⇒ Object (readonly)
Returns the value of attribute clazz.
18 19 20 |
# File 'lib/xml_pipe2/index_builder.rb', line 18 def clazz @clazz end |
#sphinx_conf ⇒ Object (readonly)
Returns the value of attribute sphinx_conf.
18 19 20 |
# File 'lib/xml_pipe2/index_builder.rb', line 18 def sphinx_conf @sphinx_conf end |
#xml_schema ⇒ Object (readonly)
Returns the value of attribute xml_schema.
18 19 20 |
# File 'lib/xml_pipe2/index_builder.rb', line 18 def xml_schema @xml_schema end |
Instance Method Details
#build ⇒ Object
20 21 22 23 24 |
# File 'lib/xml_pipe2/index_builder.rb', line 20 def build system("$(which indexer) -c #{sphinx_conf.path} #{clazz.to_s.downcase}") sphinx_conf.unlink xml_schema.unlink end |