class SchemaExtractor::Runner
Attributes
options[R]
Public Class Methods
new(args)
click to toggle source
# File lib/schema_extractor/runner.rb, line 11 def initialize(args) @options = OptionParser.new.parse(args) end
Public Instance Methods
run()
click to toggle source
# File lib/schema_extractor/runner.rb, line 15 def run schemas = extractor.extract schemas.each { |s| output(s) } end
Private Instance Methods
extractor()
click to toggle source
# File lib/schema_extractor/runner.rb, line 22 def extractor SchemaExtractor::Extractors.get_extractor(options[:source], options.to_hash.compact) end
formatter()
click to toggle source
# File lib/schema_extractor/runner.rb, line 26 def formatter @formatter ||= SchemaExtractor::Formatters.get_formatter(options[:format]) end
output(schema)
click to toggle source
# File lib/schema_extractor/runner.rb, line 30 def output(schema) path = File.join(options[:output], "#{schema.name}#{formatter.extension}") File.write(path, formatter.format(schema)) end