Class: Gexp::Handler::Transition
- Inherits:
-
Object
- Object
- Gexp::Handler::Transition
- Defined in:
- lib/gexp/handler/transition.rb,
lib/gexp/handler/transition/builder.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Builder
Instance Attribute Summary collapse
-
#object ⇒ Object
Returns the value of attribute object.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#transition ⇒ Object
Returns the value of attribute transition.
Class Method Summary collapse
Instance Method Summary collapse
- #actor_support?(actor) ⇒ Boolean
- #config ⇒ Object
-
#handlers(type = nil) ⇒ Array(Gexp::Handler)
Возвращает массив обработчиков.
-
#initialize(transition, object = nil, subject = nil, provider = nil) ⇒ Transition
constructor
A new instance of Transition.
-
#produce(params, type) ⇒ Object
Создает объект обработчика.
Constructor Details
#initialize(transition, object = nil, subject = nil, provider = nil) ⇒ Transition
Note:
Выбор конечного объекта определяется конфигом object
Returns a new instance of Transition.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gexp/handler/transition.rb', line 21 def initialize(transition, object = nil, subject = nil, provider = nil) @transition = transition actor = @transition.args.first unless self.actor_support?(actor) raise "Unsupported actor type #{@actor.class.name}" else @actor = actor end end |
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
5 6 7 |
# File 'lib/gexp/handler/transition.rb', line 5 def object @object end |
#provider ⇒ Object
Returns the value of attribute provider.
5 6 7 |
# File 'lib/gexp/handler/transition.rb', line 5 def provider @provider end |
#subject ⇒ Object
Returns the value of attribute subject.
5 6 7 |
# File 'lib/gexp/handler/transition.rb', line 5 def subject @subject end |
#transition ⇒ Object
Returns the value of attribute transition.
5 6 7 |
# File 'lib/gexp/handler/transition.rb', line 5 def transition @transition end |
Class Method Details
Instance Method Details
#actor_support?(actor) ⇒ Boolean
48 49 50 |
# File 'lib/gexp/handler/transition.rb', line 48 def actor_support?(actor) !actor.nil? end |
#config ⇒ Object
44 45 46 |
# File 'lib/gexp/handler/transition.rb', line 44 def config @config ||= self.object.config end |
#handlers(type = nil) ⇒ Array(Gexp::Handler)
Возвращает массив обработчиков
63 64 65 66 67 68 |
# File 'lib/gexp/handler/transition.rb', line 63 def handlers(type = nil) type ||= :checkers (self.send(type) || []).map do |handler_params| self.produce(handler_params, type) end end |