Class: ActiveSchema::FilteredSchemaReader

Inherits:
Object
  • Object
show all
Defined in:
lib/active_schema/schema_feeder.rb

Instance Method Summary collapse

Constructor Details

#initialize(schema_feeder, schema) ⇒ FilteredSchemaReader

Returns a new instance of FilteredSchemaReader.



5
6
7
8
# File 'lib/active_schema/schema_feeder.rb', line 5

def initialize(schema_feeder, schema)
  @schema_feeder = schema_feeder
  @schema = schema
end

Instance Method Details

#evaluateObject



14
15
16
# File 'lib/active_schema/schema_feeder.rb', line 14

def evaluate
  @schema_feeder.instance_eval(filtered_lines*"\n")
end

#filtered_linesObject



10
11
12
# File 'lib/active_schema/schema_feeder.rb', line 10

def filtered_lines
  @schema.split.grep /^\s*(add_index|add_foreign_key)/
end