Class: Banco::GetFile
- Inherits:
-
Object
- Object
- Banco::GetFile
- Defined in:
- lib/banco/get_file.rb
Instance Attribute Summary collapse
-
#csv_file_name ⇒ Object
readonly
Returns the value of attribute csv_file_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#summary_name ⇒ Object
readonly
Returns the value of attribute summary_name.
Instance Method Summary collapse
- #file_checker_cleaner(filename) ⇒ Object
-
#initialize ⇒ GetFile
constructor
A new instance of GetFile.
- #make_name ⇒ Object
Constructor Details
#initialize ⇒ GetFile
Returns a new instance of GetFile.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/banco/get_file.rb', line 6 def initialize @csv_file_name = gets.chomp.downcase if @csv_file_name == 'q' Viewable::farewell exit else file_checker_cleaner(@csv_file_name) @name = @csv_file_name.split('.').first make_name end end |
Instance Attribute Details
#csv_file_name ⇒ Object (readonly)
Returns the value of attribute csv_file_name.
4 5 6 |
# File 'lib/banco/get_file.rb', line 4 def csv_file_name @csv_file_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/banco/get_file.rb', line 4 def name @name end |
#summary_name ⇒ Object (readonly)
Returns the value of attribute summary_name.
4 5 6 |
# File 'lib/banco/get_file.rb', line 4 def summary_name @summary_name end |
Instance Method Details
#file_checker_cleaner(filename) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/banco/get_file.rb', line 25 def file_checker_cleaner(filename) if filename =~ /([^\s]+(\.csv)$)/ puts "\nloading #{filename}..." else puts "#{filename} isn't a valid file for Banco !".center(54) throw end end |
#make_name ⇒ Object
18 19 20 21 22 23 |
# File 'lib/banco/get_file.rb', line 18 def make_name @name = @csv_file_name.split('.').first @doctype = @csv_file_name.split('.').last @summary_name = @name @csv_file_name end |