Class: PolishGeeks::DevTools::Commands::EmptyMethods::FileParser
- Inherits:
-
Object
- Object
- PolishGeeks::DevTools::Commands::EmptyMethods::FileParser
- Defined in:
- lib/polish_geeks/dev_tools/commands/empty_methods/file_parser.rb
Overview
Parse file and search whether it contain empty methods
Instance Attribute Summary collapse
-
#empty_methods ⇒ Object
readonly
Returns the value of attribute empty_methods.
Instance Method Summary collapse
-
#find_empty_methods ⇒ Array<Fixnum>
List of lines where empty methods are defined.
-
#initialize(file) ⇒ FileParser
constructor
A new instance of FileParser.
Constructor Details
#initialize(file) ⇒ FileParser
Returns a new instance of FileParser.
10 11 12 13 |
# File 'lib/polish_geeks/dev_tools/commands/empty_methods/file_parser.rb', line 10 def initialize(file) @file = IO.readlines(file) @empty_methods = [] end |
Instance Attribute Details
#empty_methods ⇒ Object (readonly)
Returns the value of attribute empty_methods.
7 8 9 |
# File 'lib/polish_geeks/dev_tools/commands/empty_methods/file_parser.rb', line 7 def empty_methods @empty_methods end |
Instance Method Details
#find_empty_methods ⇒ Array<Fixnum>
Returns list of lines where empty methods are defined.
25 26 27 28 29 30 31 |
# File 'lib/polish_geeks/dev_tools/commands/empty_methods/file_parser.rb', line 25 def find_empty_methods @file.each_with_index do |line, index| next add_empty_method(index) if line.one_line_empty_method? check_bodies_existence(line, index) end empty_methods end |