Class: Trains::Visitor::Schema
- Defined in:
- lib/trains/visitor/schema.rb
Overview
Visitor that parses DB migration and associates them with Rails models
Instance Method Summary collapse
-
#initialize ⇒ Schema
constructor
A new instance of Schema.
- #on_block(node) ⇒ Object
- #result ⇒ Object
Constructor Details
#initialize ⇒ Schema
Returns a new instance of Schema.
17 18 19 20 21 |
# File 'lib/trains/visitor/schema.rb', line 17 def initialize @models = [] @columns = [] @is_versioned = false end |
Instance Method Details
#on_block(node) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/trains/visitor/schema.rb', line 23 def on_block(node) is_schema = versioned_schema?(node) || unversioned_schema?(node) return unless is_schema process_schema_body(node) end |
#result ⇒ Object
30 31 32 |
# File 'lib/trains/visitor/schema.rb', line 30 def result @models end |