Class: RubyEventStore::ActiveRecord::DatabaseAdapter
- Inherits:
-
Object
- Object
- RubyEventStore::ActiveRecord::DatabaseAdapter
show all
- Defined in:
- lib/ruby_event_store/active_record/generators/database_adapter.rb
Defined Under Namespace
Classes: MySQL, PostgreSQL, SQLite
Constant Summary
collapse
- NONE =
Object.new.freeze
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(data_type = NONE) ⇒ DatabaseAdapter
Returns a new instance of DatabaseAdapter.
43
44
45
46
47
48
49
|
# File 'lib/ruby_event_store/active_record/generators/database_adapter.rb', line 43
def initialize(data_type = NONE)
raise UnsupportedAdapter if instance_of?(DatabaseAdapter)
validate_data_type!(data_type)
@data_type = data_type
end
|
Instance Attribute Details
#data_type ⇒ Object
Returns the value of attribute data_type.
51
52
53
|
# File 'lib/ruby_event_store/active_record/generators/database_adapter.rb', line 51
def data_type
@data_type
end
|
Class Method Details
.from_string(adapter_name, data_type = NONE) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/ruby_event_store/active_record/generators/database_adapter.rb', line 70
def self.from_string(adapter_name, data_type = NONE)
raise NoMethodError unless eql?(DatabaseAdapter)
case adapter_name.to_s.downcase
when "postgresql", "postgis"
PostgreSQL.new(data_type)
when "mysql2", "trilogy"
MySQL.new(data_type)
when "sqlite"
SQLite.new(data_type)
else
raise UnsupportedAdapter, "Unsupported adapter: #{adapter_name.inspect}"
end
end
|
Instance Method Details
#eql?(other) ⇒ Boolean
Also known as:
==
57
58
59
|
# File 'lib/ruby_event_store/active_record/generators/database_adapter.rb', line 57
def eql?(other)
other.is_a?(DatabaseAdapter) && adapter_name.eql?(other.adapter_name)
end
|
#hash ⇒ Object
63
64
65
|
# File 'lib/ruby_event_store/active_record/generators/database_adapter.rb', line 63
def hash
DatabaseAdapter.hash ^ adapter_name.hash
end
|
#supported_data_types ⇒ Object
53
54
55
|
# File 'lib/ruby_event_store/active_record/generators/database_adapter.rb', line 53
def supported_data_types
self.class::SUPPORTED_DATA_TYPES
end
|
#template_directory ⇒ Object
67
68
|
# File 'lib/ruby_event_store/active_record/generators/database_adapter.rb', line 67
def template_directory
end
|