class TokyoMetro::Document::MakeExamples::Static::EachFile

Public Class Methods

new( filename ) click to toggle source
# File lib/tokyo_metro/document/make_examples/static/each_file.rb, line 3
def initialize( filename )
  @filename = filename
  ary = open( @filename , "r:utf-8" ).read.split( /\n{3,}/ )

  indent_n , *infos_of_method = ary
  @indent = indent_n.gsub( /\Aindent \: / , "" ).to_i
  @infos_of_method = infos_of_method.map { | info_in_rows |
    variables = info_in_rows.split( /\n+/ )
    EachMethod.new( @indent , *variables )
  }
end

Public Instance Methods

process() click to toggle source
# File lib/tokyo_metro/document/make_examples/static/each_file.rb, line 15
def process
  file = ::File.open( filename_of_result , "w:utf-8" )
  file.print( @infos_of_method.map( &:to_s ).join( "\n" * 3 ) )
  file.close
end

Private Instance Methods

filename_of_result() click to toggle source
# File lib/tokyo_metro/document/make_examples/static/each_file.rb, line 23
def filename_of_result
  @filename.gsub( /(?<=make_examples_in_document\/)base\// , "result/" )
end