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.



83
84
85
# File 'lib/schemard/schema_parser.rb', line 83

def initialize(filename)
  @filename = filename
end

Instance Method Details

#parse(with_comment: false) ⇒ Object



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

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