Module: FileSplit

Defined in:
lib/file_split.rb,
lib/file_split/version.rb,
lib/file_split/file_splitter.rb

Defined Under Namespace

Classes: FileSplitter

Constant Summary collapse

VERSION =
"0.0.2"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



7
8
9
# File 'lib/file_split.rb', line 7

def config
  @config
end

Class Method Details

.start(source, target, lines, maxlines, header, footer) ⇒ Object

FileSplitter Wrap

Example:

>> FileSplit.start /path/out/large.sql, /path/in/small.sql, 1000, 0, 2, 2
=> void

Attributes:

source: (String)
target: (String)
lines: (Integer)
maxlines: (Integer)
header: (Integer)
footer: (Integer)


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/file_split.rb', line 24

def self.start(source, target, lines, maxlines, header, footer)
  begin
    @config = {
        :source => source,
        :target => target,
        :lines => lines.to_i,
        :maxlines => maxlines.to_i,
        :header => header.to_i,
        :footer => footer.to_i
    }
    instance = FileSplitter.new
    instance.start
  rescue StandardError => e
    puts e.message
    puts e.backtrace.join("\n") if e.backtrace
  end
end