Class: Migflow::Services::SchemaBuilder
- Inherits:
-
Object
- Object
- Migflow::Services::SchemaBuilder
- Defined in:
- lib/migflow/services/schema_builder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(schema_path:) ⇒ SchemaBuilder
constructor
A new instance of SchemaBuilder.
Constructor Details
#initialize(schema_path:) ⇒ SchemaBuilder
Returns a new instance of SchemaBuilder.
10 11 12 |
# File 'lib/migflow/services/schema_builder.rb', line 10 def initialize(schema_path:) @schema_path = schema_path end |
Class Method Details
.call(schema_path:) ⇒ Object
6 7 8 |
# File 'lib/migflow/services/schema_builder.rb', line 6 def self.call(schema_path:) new(schema_path: schema_path).build end |
Instance Method Details
#build ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/migflow/services/schema_builder.rb', line 14 def build parsed = Parsers::SchemaParser.call(schema_path: @schema_path) Models::MigrationSnapshot.new( version: parsed[:version], name: "Current schema", tables: parsed[:tables], raw_content: Pathname.new(@schema_path).read ) end |