Class: Crystalball::Rails::Helpers::SchemaDefinitionParser

Inherits:
Object
  • Object
show all
Includes:
BaseSchemaParser
Defined in:
lib/crystalball/rails/helpers/schema_definition_parser.rb,
lib/crystalball/rails/helpers/schema_definition_parser/active_record.rb,
lib/crystalball/rails/helpers/schema_definition_parser/table_content_parser.rb

Overview

Class used to parse ActiveRecord::Schema definition and provide hash representation

Defined Under Namespace

Modules: ActiveRecord Classes: TableContentParser

Instance Attribute Summary

Attributes included from BaseSchemaParser

#hash

Class Method Summary collapse

Methods included from BaseSchemaParser

#initialize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Crystalball::Rails::Helpers::BaseSchemaParser

Class Method Details

.parse(schema) ⇒ Hash

Parse schema content

Parameters:

  • schema (String)
    • schema file content

Returns:

  • (Hash)

    hash representation of schema



17
18
19
20
21
# File 'lib/crystalball/rails/helpers/schema_definition_parser.rb', line 17

def self.parse(schema)
  return {} if schema&.empty?

  new.instance_eval(schema)
end