Class: ActiveMocker::ActiveRecord::Schema Private
- Inherits:
-
Object
- Object
- ActiveMocker::ActiveRecord::Schema
- Defined in:
- lib/active_mocker/active_record/schema.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .add_to_cache(table) ⇒ Object private
- .clear_cache ⇒ Object private
- .define(options, &block) ⇒ Object private
- .parse ⇒ Object private
- .search(table_name) ⇒ Object private
- .search_cache(table_name) ⇒ Object private
Class Method Details
.add_to_cache(table) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 22 |
# File 'lib/active_mocker/active_record/schema.rb', line 19 def self.add_to_cache(table) @tables_cache ||= [] @tables_cache << table unless table.nil? end |
.clear_cache ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 |
# File 'lib/active_mocker/active_record/schema.rb', line 31 def self.clear_cache @tables_cache = [] end |
.define(options, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 9 10 11 12 13 |
# File 'lib/active_mocker/active_record/schema.rb', line 6 def self.define(, &block) version = [:version] search_result = search_cache(@table_search) search_result unless search_result.nil? schema = parse schema.instance_eval(&block) schema end |
.parse ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/active_mocker/active_record/schema.rb', line 15 def self.parse SchemaParser.new(@table_search) end |
.search(table_name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 |
# File 'lib/active_mocker/active_record/schema.rb', line 35 def self.search(table_name) @table_search = table_name search_cache(table_name) end |
.search_cache(table_name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 27 28 29 |
# File 'lib/active_mocker/active_record/schema.rb', line 24 def self.search_cache(table_name) @tables_cache ||= [] @tables_cache.find do |h| h.name == table_name end end |