Class: ImporteerPlan::Importeer
- Inherits:
-
Object
- Object
- ImporteerPlan::Importeer
- Defined in:
- lib/importeer_plan.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#initial ⇒ Object
Returns the value of attribute initial.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#path ⇒ Object
Returns the value of attribute path.
-
#sep ⇒ Object
Returns the value of attribute sep.
-
#size_batch ⇒ Object
Returns the value of attribute size_batch.
Class Method Summary collapse
Instance Method Summary collapse
- #bron ⇒ Object
-
#commaf(str) ⇒ Object
comma-float; “1,234”.
- #importeer ⇒ Object
-
#initialize(name, options = {}) ⇒ Importeer
constructor
A new instance of Importeer.
-
#pointf(str) ⇒ Object
point-float; “1.234”.
- #sweep ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ Importeer
Returns a new instance of Importeer.
13 14 15 16 17 18 19 20 |
# File 'lib/importeer_plan.rb', line 13 def initialize(name, ={}) @options = @name = name @path = Importeer.dir.join( @name ) @size_batch = [:size_batch]||1000 @sep = [:sep]|| ";" @initial = [:initial]|| false end |
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
8 9 10 |
# File 'lib/importeer_plan.rb', line 8 def dir @dir end |
#initial ⇒ Object
Returns the value of attribute initial.
8 9 10 |
# File 'lib/importeer_plan.rb', line 8 def initial @initial end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/importeer_plan.rb', line 8 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/importeer_plan.rb', line 8 def @options end |
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/importeer_plan.rb', line 8 def path @path end |
#sep ⇒ Object
Returns the value of attribute sep.
8 9 10 |
# File 'lib/importeer_plan.rb', line 8 def sep @sep end |
#size_batch ⇒ Object
Returns the value of attribute size_batch.
8 9 10 |
# File 'lib/importeer_plan.rb', line 8 def size_batch @size_batch end |
Class Method Details
.dir ⇒ Object
22 23 24 25 26 27 |
# File 'lib/importeer_plan.rb', line 22 def self.dir # Rails.root.join('public/imports/') ImporteerPlan.configuration.dir end |
Instance Method Details
#bron ⇒ Object
29 30 |
# File 'lib/importeer_plan.rb', line 29 def bron end |
#commaf(str) ⇒ Object
comma-float; “1,234”
40 41 42 |
# File 'lib/importeer_plan.rb', line 40 def commaf(str) # comma-float; "1,234" ('%.2f' % str.gsub(',', '.') ).to_f end |
#importeer ⇒ Object
35 36 37 38 |
# File 'lib/importeer_plan.rb', line 35 def importeer sweep bron.each{|batch| importeer_batch batch} end |
#pointf(str) ⇒ Object
point-float; “1.234”
44 45 46 |
# File 'lib/importeer_plan.rb', line 44 def pointf(str) # point-float; "1.234" ('%.2f' % str.gsub(',', '.') ).to_f end |
#sweep ⇒ Object
32 33 |
# File 'lib/importeer_plan.rb', line 32 def sweep end |