Class: RichEmailValidator::FileValidator
- Inherits:
-
Object
- Object
- RichEmailValidator::FileValidator
- Defined in:
- lib/rich_email_validator/file_validator.rb
Overview
Validate input file emails and save valid ones to another output file
Instance Attribute Summary collapse
-
#input_file_path ⇒ Object
readonly
Returns the value of attribute input_file_path.
Class Method Summary collapse
-
.export_valid_list(input_file_path, output_file_path, options = {}) ⇒ Object
Validates input from file and write to file.
-
.filter(input_file_path, options = {}) ⇒ Array
Validates input from file.
Instance Method Summary collapse
-
#export_valid_list(output_file_path) ⇒ Object
Validates input from file and writes to file.
-
#filter ⇒ Array
Validates input from file.
-
#initialize(input_file_path, options = {}) ⇒ FileValidator
constructor
Validates input from file.
Constructor Details
#initialize(input_file_path, options = {}) ⇒ FileValidator
Validates input from file
33 34 35 36 |
# File 'lib/rich_email_validator/file_validator.rb', line 33 def initialize(input_file_path, = {}) @input_file_path = input_file_path @options = end |
Instance Attribute Details
#input_file_path ⇒ Object (readonly)
Returns the value of attribute input_file_path.
4 5 6 |
# File 'lib/rich_email_validator/file_validator.rb', line 4 def input_file_path @input_file_path end |
Class Method Details
.export_valid_list(input_file_path, output_file_path, options = {}) ⇒ Object
Validates input from file and write to file
23 24 25 |
# File 'lib/rich_email_validator/file_validator.rb', line 23 def export_valid_list(input_file_path, output_file_path, = {}) new(input_file_path, ).export_valid_list(output_file_path) end |
.filter(input_file_path, options = {}) ⇒ Array
Validates input from file
13 14 15 |
# File 'lib/rich_email_validator/file_validator.rb', line 13 def filter(input_file_path, = {}) new(input_file_path, ).filter end |
Instance Method Details
#export_valid_list(output_file_path) ⇒ Object
Validates input from file and writes to file
45 46 47 48 49 |
# File 'lib/rich_email_validator/file_validator.rb', line 45 def export_valid_list(output_file_path) File.open(output_file_path, 'w') do |file| filter.each { |email| file.puts(email) } end end |
#filter ⇒ Array
Validates input from file
40 41 42 |
# File 'lib/rich_email_validator/file_validator.rb', line 40 def filter @filtered ||= run_filter end |