Class: Tengine::Core::Driver
- Inherits:
-
Object
- Object
- Tengine::Core::Driver
show all
- Includes:
- Mongoid::Document, Mongoid::Timestamps, FindByName, Validation
- Defined in:
- lib/tengine/core/driver.rb
Overview
イベントドライバ
イベントに対する処理はイベントハンドラによって実行されますが、イベントドライバはそのイベントハンドラの上位の概念です。 イベントハンドラは必ずイベントドライバの中に定義されます。
またイベントドライバは有効化/無効化を設定する単位であり、起動時の設定あるいはユーザーの指定によって変更することができます。
Defined Under Namespace
Classes: Finder
Constant Summary
Constants included
from Validation
Validation::BASE_NAME, Validation::EVENT_TYPE_NAME, Validation::RESOURCE_IDENTIFIER, Validation::RESOURCE_IDENTIFIER_PROTOCOL_FORMAT
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#バージョン。デプロイされた際に設定されます。 ⇒ Object
23
|
# File 'lib/tengine/core/driver.rb', line 23
field :version, :type => String
|
#名前 ⇒ Object
20
|
# File 'lib/tengine/core/driver.rb', line 20
field :name, :type => String
|
#実行時有効/無効 ⇒ Object
29
|
# File 'lib/tengine/core/driver.rb', line 29
field :enabled_on_activation, :type => Boolean, :default => true
|
#対象クラス名 ⇒ Object
32
|
# File 'lib/tengine/core/driver.rb', line 32
field :target_class_name, :type => String
|
#有効/無効 ⇒ Object
26
|
# File 'lib/tengine/core/driver.rb', line 26
field :enabled, :type => Boolean
|
Class Method Details
.delete_all_with_handler_paths(dsl_version) ⇒ Object
77
78
79
80
81
|
# File 'lib/tengine/core/driver.rb', line 77
def delete_all_with_handler_paths(dsl_version)
drivers = Tengine::Core::Driver.where(:version => dsl_version)
Tengine::Core::HandlerPath.where(:driver_id.in => drivers.map(&:id)).delete_all
drivers.delete_all
end
|
.find_by_name(name, options = {}) ⇒ Object
Tengine::Core::FindByName で定義しているクラスメソッドfind_by_nameを上書きしています
72
73
74
75
|
# File 'lib/tengine/core/driver.rb', line 72
def find_by_name(name, options = {})
version = options[:version] || Tengine::Core::Setting.dsl_version
where({:name => name, :version => version}).first
end
|
Instance Method Details
#create_session ⇒ Object
57
58
59
|
# File 'lib/tengine/core/driver.rb', line 57
def create_session
self.session ||= Tengine::Core::Session.create
end
|
#delete_handler_paths ⇒ Object
65
66
67
68
|
# File 'lib/tengine/core/driver.rb', line 65
def delete_handler_paths
return if new_record?
Tengine::Core::HandlerPath.where(:driver_id => self.id).delete_all
end
|
#update_handler_path ⇒ Object
61
62
63
|
# File 'lib/tengine/core/driver.rb', line 61
def update_handler_path
handlers.each(&:update_handler_path)
end
|