Class: Scheman::Diff
- Inherits:
-
Object
- Object
- Scheman::Diff
- Defined in:
- lib/scheman/diff.rb
Instance Method Summary collapse
-
#initialize(before: nil, after: nil, type: nil, before_type: nil, after_type: nil, output_type: nil) ⇒ Diff
constructor
A new instance of Diff.
-
#to_hash ⇒ Hash
A hash representation of this diff.
-
#to_s ⇒ String
A string representation of this diff.
Constructor Details
#initialize(before: nil, after: nil, type: nil, before_type: nil, after_type: nil, output_type: nil) ⇒ Diff
Returns a new instance of Diff.
10 11 12 13 14 15 16 17 18 |
# File 'lib/scheman/diff.rb', line 10 def initialize(before: nil, after: nil, type: nil, before_type: nil, after_type: nil, output_type: nil) @before = before @after = after @type = type @before_type = before_type @after_type = after_type @output_type = output_type validate! end |
Instance Method Details
#to_hash ⇒ Hash
Note:
Passed to Parslet::Transform to convert into SQL string
Returns A hash representation of this diff.
27 28 29 30 31 32 33 |
# File 'lib/scheman/diff.rb', line 27 def to_hash { alter_tables: alter_tables, create_tables: create_tables, drop_tables: drop_tables, } end |
#to_s ⇒ String
Returns A string representation of this diff.
21 22 23 |
# File 'lib/scheman/diff.rb', line 21 def to_s view_class.new(to_hash).to_s end |