Class: SchemaRD::SchemaParser

Inherits:
Object
  • Object
show all
Defined in:
lib/schemard/schema_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ SchemaParser

Returns a new instance of SchemaParser.



81
82
83
# File 'lib/schemard/schema_parser.rb', line 81

def initialize(filename)
  @filename = filename
end

Instance Method Details

#parse(with_comment: false) ⇒ Object



84
85
86
87
88
89
90
# File 'lib/schemard/schema_parser.rb', line 84

def parse(with_comment: false)
  Schema.new.tap do |schema|
    File.open(@filename) do |file|
      MigrationContext::Loader.new(schema, with_comment: with_comment).instance_eval(file.read, @filename)
    end
  end
end