Class: TokyoMetro::Rake::CheckNamespace::RenameTable::Namespace
- Inherits:
-
Object
- Object
- TokyoMetro::Rake::CheckNamespace::RenameTable::Namespace
- Includes:
- InfoOfRows
- Defined in:
- lib/tokyo_metro/rake/check_namespace/rename_table/namespace.rb
Defined Under Namespace
Modules: InfoOfRows Classes: MatchGroup, MatchedRow
Instance Method Summary collapse
- #display ⇒ Object
-
#initialize(namespace, filenames) ⇒ Namespace
constructor
A new instance of Namespace.
- #search ⇒ Object
Constructor Details
#initialize(namespace, filenames) ⇒ Namespace
Returns a new instance of Namespace.
23 24 25 26 27 28 |
# File 'lib/tokyo_metro/rake/check_namespace/rename_table/namespace.rb', line 23 def initialize( namespace , filenames ) @namespace = namespace @filenames = filenames @matched_rows = ::Array.new @regexp_list = regexp_list end |
Instance Method Details
#display ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/tokyo_metro/rake/check_namespace/rename_table/namespace.rb', line 51 def display puts "=" * 64 puts "" puts "**** #{ @namespace }" puts "" indent = 4 _filename_length_max = filename_length_max @matched_rows.group_by( &:regexp_index ).each do | regexp_index , rows | ::TokyoMetro::Rake::CheckNamespace::RenameTable::Namespace::MatchGroup.new( rows , @regexp_list[ regexp_index ] , _filename_length_max ).display( indent ) end display_info_of_rows end |
#search ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/tokyo_metro/rake/check_namespace/rename_table/namespace.rb', line 32 def search @filenames.each do | filename | #-------- [begin] processing each file ::File.open( filename , "r:UTF-8" ).read.split( "\n" ).each.with_index(1) do | row_content , row_number | match = false #-------- [begin] processing each regexp @regexp_list.each_with_index do | regexp , i | if regexp === row_content @matched_rows << ::TokyoMetro::Rake::CheckNamespace::RenameTable::Namespace::MatchedRow.new( filename , row_content , row_number , i ) end end #-------- [end] processing each regexp end #-------- [end] processing each file end return self end |