Class: DroppableTable::SchemaParser
- Inherits:
-
Object
- Object
- DroppableTable::SchemaParser
- Defined in:
- lib/droppable_table/schema_parser.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#schema_path ⇒ Object
readonly
Returns the value of attribute schema_path.
Instance Method Summary collapse
-
#initialize(schema_path) ⇒ SchemaParser
constructor
A new instance of SchemaParser.
- #parse ⇒ Object
Constructor Details
#initialize(schema_path) ⇒ SchemaParser
Returns a new instance of SchemaParser.
7 8 9 10 |
# File 'lib/droppable_table/schema_parser.rb', line 7 def initialize(schema_path) @schema_path = schema_path @format = detect_format end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
5 6 7 |
# File 'lib/droppable_table/schema_parser.rb', line 5 def format @format end |
#schema_path ⇒ Object (readonly)
Returns the value of attribute schema_path.
5 6 7 |
# File 'lib/droppable_table/schema_parser.rb', line 5 def schema_path @schema_path end |
Instance Method Details
#parse ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/droppable_table/schema_parser.rb', line 12 def parse case format when :ruby parse_ruby_schema when :sql parse_sql_schema else raise SchemaNotFoundError, "Unknown schema format: #{schema_path}" end end |