Sha256: d96bf99d84d6c4b706cf7ef683c2f40c2c50862c076a6da3eec7b54477d15163
Contents?: true
Size: 837 Bytes
Versions: 1
Compression:
Stored size: 837 Bytes
Contents
module ActiveMocker class SchemaReader attr_reader :model_name, :relative_path, :file_reader, :table def initialize(options={}) @file_reader = options[:file_reader] ||= FileReader @relative_path = options[:path] end def search(model_name) @model_name = model_name @table = search_schema_file end private def table_name model_name end def not_found raise "#{table_name} table not found." if @schema_result.nil? end def search_schema_file ActiveMocker::ActiveRecord::Schema.search(table_name) @schema_result = eval_file not_found @schema_result end def eval_file m = Module.new m.module_eval(read_file) end def read_file file_reader.read("#{relative_path}/schema.rb") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_mocker-0.1.1 | lib/active_mocker/schema_reader.rb |