Class: Edgestitch::Stitcher
- Inherits:
-
Object
- Object
- Edgestitch::Stitcher
- Defined in:
- lib/edgestitch/stitcher.rb
Overview
Renders a structure.sql file based on all given engine’s structure-self.sql
Class Method Summary collapse
Instance Method Summary collapse
- #each_file(&block) ⇒ Object
-
#initialize(engines) ⇒ Stitcher
constructor
A new instance of Stitcher.
Constructor Details
#initialize(engines) ⇒ Stitcher
Returns a new instance of Stitcher.
11 12 13 |
# File 'lib/edgestitch/stitcher.rb', line 11 def initialize(engines) @engines = Set.new(engines) end |
Class Method Details
.to_file(file, *engines) ⇒ Object
21 22 23 |
# File 'lib/edgestitch/stitcher.rb', line 21 def self.to_file(file, *engines) File.write(file, new(engines).render) end |
Instance Method Details
#each_file(&block) ⇒ Object
15 16 17 18 19 |
# File 'lib/edgestitch/stitcher.rb', line 15 def each_file(&block) @engines.map { |engine| engine.root.join("db", "structure-self.sql") } .filter(&:exist?) .uniq.each(&block) end |