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.
-
#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 = {size_batch: 1000, sep: ";", initial: false}) ⇒ Importeer
constructor
A new instance of Importeer.
-
#pointf(str) ⇒ Object
point-float; “1.234”.
Constructor Details
#initialize(name, options = {size_batch: 1000, sep: ";", initial: false}) ⇒ Importeer
Returns a new instance of Importeer.
12 13 14 15 16 17 18 |
# File 'lib/importeer_plan.rb', line 12 def initialize(name, = {size_batch: 1000, sep: ";", initial: false}) @name = name @path = Importeer.dir.join( @name ) @size_batch = [:size_batch]#||1000 @sep = [:sep] @initial = [:initial] end |
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
7 8 9 |
# File 'lib/importeer_plan.rb', line 7 def dir @dir end |
#initial ⇒ Object
Returns the value of attribute initial.
7 8 9 |
# File 'lib/importeer_plan.rb', line 7 def initial @initial end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/importeer_plan.rb', line 7 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
7 8 9 |
# File 'lib/importeer_plan.rb', line 7 def path @path end |
#sep ⇒ Object
Returns the value of attribute sep.
7 8 9 |
# File 'lib/importeer_plan.rb', line 7 def sep @sep end |
#size_batch ⇒ Object
Returns the value of attribute size_batch.
7 8 9 |
# File 'lib/importeer_plan.rb', line 7 def size_batch @size_batch end |
Class Method Details
.dir ⇒ Object
20 21 22 |
# File 'lib/importeer_plan.rb', line 20 def self.dir Rails.root.join('public/imports/') end |
Instance Method Details
#bron ⇒ Object
24 25 |
# File 'lib/importeer_plan.rb', line 24 def bron end |
#commaf(str) ⇒ Object
comma-float; “1,234”
31 32 33 |
# File 'lib/importeer_plan.rb', line 31 def commaf(str) # comma-float; "1,234" ('%.2f' % str.gsub(',', '.') ).to_f end |
#importeer ⇒ Object
27 28 29 |
# File 'lib/importeer_plan.rb', line 27 def importeer bron.each{|batch| importeer_batch batch} end |
#pointf(str) ⇒ Object
point-float; “1.234”
35 36 37 |
# File 'lib/importeer_plan.rb', line 35 def pointf(str) # point-float; "1.234" ('%.2f' % str.gsub(',', '.') ).to_f end |