Sha256: 0796ff256d4cc5b56dec2be240bb374126be76560593a8b8de243648f5741193

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

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

  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

  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

  def filename_of_result
    @filename.gsub( /(?<=make_examples_in_document\/)base\// , "result/" )
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/document/make_examples/static/each_file.rb