Class: Dataexport::GetData
- Inherits:
-
Object
- Object
- Dataexport::GetData
- Defined in:
- lib/dataexport.rb
Overview
Your code goes here…
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(data) ⇒ GetData
constructor
A new instance of GetData.
- #writeToFile ⇒ Object
- #writeToFileJson ⇒ Object
- #writeToFilePlain ⇒ Object
Constructor Details
#initialize(data) ⇒ GetData
Returns a new instance of GetData.
9 10 11 |
# File 'lib/dataexport.rb', line 9 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
8 9 10 |
# File 'lib/dataexport.rb', line 8 def data @data end |
Instance Method Details
#writeToFile ⇒ Object
13 14 15 16 17 18 |
# File 'lib/dataexport.rb', line 13 def writeToFile() out_file = File.new("result.csv", "w") out_file.puts(@data) out_file.close return out_file end |
#writeToFileJson ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dataexport.rb', line 20 def writeToFileJson() out_file = File.new("result3.csv", "w") @data.each do |value| value.each do |i| out_file.puts(i) end end out_file.close return out_file end |
#writeToFilePlain ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/dataexport.rb', line 32 def writeToFilePlain() out_file = File.new("result2.csv", "w") @data.each do |value| value.each do |i| i.each do |j| out_file.puts(j) end end end out_file.close return out_file end |