Class: Chouette::Exporter
- Inherits:
-
Object
- Object
- Chouette::Exporter
- Includes:
- CommandLineSupport
- Defined in:
- app/models/chouette/exporter.rb
Instance Attribute Summary collapse
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
- #chouette_command ⇒ Object
- #export(file, options = {}) ⇒ Object
-
#initialize(schema) ⇒ Exporter
constructor
A new instance of Exporter.
Methods included from CommandLineSupport
#available_loggers, #execute!, #logger, #max_output_length
Constructor Details
#initialize(schema) ⇒ Exporter
Returns a new instance of Exporter.
5 6 7 |
# File 'app/models/chouette/exporter.rb', line 5 def initialize(schema) @schema = schema end |
Instance Attribute Details
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
3 4 5 |
# File 'app/models/chouette/exporter.rb', line 3 def schema @schema end |
Instance Method Details
#chouette_command ⇒ Object
9 10 11 |
# File 'app/models/chouette/exporter.rb', line 9 def chouette_command @chouette_command ||= Chouette::Command.new(:schema => schema) end |
#export(file, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/chouette/exporter.rb', line 13 def export(file, = {}) = { :format => :neptune }.merge() = { :c => "export", :o => "line", :format => .delete(:format).to_s.upcase, :output_file => File.(file), :optimize_memory => true }.merge() logger.info "Export #{file} in schema #{schema}" chouette_command.run! end |