Class: Schema2type::CovertService
- Inherits:
-
Object
- Object
- Schema2type::CovertService
- Defined in:
- lib/schema2type/covert_service.rb
Defined Under Namespace
Modules: ActiveRecord
Class Method Summary collapse
Instance Method Summary collapse
-
#convert_schema_to_type(table_name) {|converter| ... } ⇒ Object
(also: #create_table)
mock method for create_table in schema.rb.
- #get_binding ⇒ Object
-
#initialize(is_snake_case) ⇒ CovertService
constructor
A new instance of CovertService.
- #method_missing ⇒ Object
- #skip_dsl ⇒ Object (also: #add_foreign_key)
Constructor Details
#initialize(is_snake_case) ⇒ CovertService
Returns a new instance of CovertService.
3 4 5 6 |
# File 'lib/schema2type/covert_service.rb', line 3 def initialize(is_snake_case) @converted_types = [] @is_snake_case = is_snake_case end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing ⇒ Object
23 24 25 26 |
# File 'lib/schema2type/covert_service.rb', line 23 def method_missing(*) # To exclude unnecessary methods # TODO: add error handling end |
Class Method Details
.method_missing ⇒ Object
28 29 30 31 |
# File 'lib/schema2type/covert_service.rb', line 28 def self.method_missing(*) # To exclude unnecessary methods # TODO: add error handling end |
Instance Method Details
#convert_schema_to_type(table_name) {|converter| ... } ⇒ Object Also known as: create_table
mock method for create_table in schema.rb
13 14 15 16 17 |
# File 'lib/schema2type/covert_service.rb', line 13 def convert_schema_to_type(table_name, *) converter = SchemaConverter.new(table_name: table_name, is_snake_case: @is_snake_case) yield converter @converted_types.concat converter.converted_type_lines end |
#get_binding ⇒ Object
8 9 10 |
# File 'lib/schema2type/covert_service.rb', line 8 def get_binding binding end |
#skip_dsl ⇒ Object Also known as: add_foreign_key
19 20 21 |
# File 'lib/schema2type/covert_service.rb', line 19 def skip_dsl(*) @converted_types end |