Class: LiveActivity::Definition
- Inherits:
-
Object
- Object
- LiveActivity::Definition
- Defined in:
- lib/live_activity/definition.rb
Instance Attribute Summary collapse
-
#act_object ⇒ Object
readonly
Returns the value of attribute act_object.
-
#act_target ⇒ Object
readonly
Returns the value of attribute act_target.
-
#actor ⇒ Object
readonly
Returns the value of attribute actor.
-
#bond_type ⇒ Object
readonly
Returns the value of attribute bond_type.
-
#grouped_actor ⇒ Object
readonly
Returns the value of attribute grouped_actor.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#receivers ⇒ Object
readonly
Returns the value of attribute receivers.
-
#reverses ⇒ Object
readonly
Returns the value of attribute reverses.
Class Method Summary collapse
- .find(name) ⇒ Object
-
.register(definition) ⇒ Definition
Registers a new definition.
-
.registered ⇒ Array<LiveActivity::Definition>
List of registered definitions.
Instance Method Summary collapse
-
#initialize(definition) ⇒ Definition
constructor
A new instance of Definition.
Constructor Details
#initialize(definition) ⇒ Definition
Returns a new instance of Definition.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/live_activity/definition.rb', line 8 def initialize(definition) @name = definition[:name] @actor = definition[:actor] || nil @act_object = definition[:act_object] || nil @act_target = definition[:act_target] || nil @grouped_actor = definition[:grouped_actor] || nil @bond_type = definition[:bond_type] || nil @options = definition[:options] || [] @reverses = definition[:reverses] || nil end |
Instance Attribute Details
#act_object ⇒ Object (readonly)
Returns the value of attribute act_object.
5 6 7 |
# File 'lib/live_activity/definition.rb', line 5 def act_object @act_object end |
#act_target ⇒ Object (readonly)
Returns the value of attribute act_target.
5 6 7 |
# File 'lib/live_activity/definition.rb', line 5 def act_target @act_target end |
#actor ⇒ Object (readonly)
Returns the value of attribute actor.
5 6 7 |
# File 'lib/live_activity/definition.rb', line 5 def actor @actor end |
#bond_type ⇒ Object (readonly)
Returns the value of attribute bond_type.
5 6 7 |
# File 'lib/live_activity/definition.rb', line 5 def bond_type @bond_type end |
#grouped_actor ⇒ Object (readonly)
Returns the value of attribute grouped_actor.
5 6 7 |
# File 'lib/live_activity/definition.rb', line 5 def grouped_actor @grouped_actor end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/live_activity/definition.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/live_activity/definition.rb', line 5 def @options end |
#receivers ⇒ Object (readonly)
Returns the value of attribute receivers.
5 6 7 |
# File 'lib/live_activity/definition.rb', line 5 def receivers @receivers end |
#reverses ⇒ Object (readonly)
Returns the value of attribute reverses.
5 6 7 |
# File 'lib/live_activity/definition.rb', line 5 def reverses @reverses end |
Class Method Details
.find(name) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/live_activity/definition.rb', line 37 def self.find(name) unless definition = registered.find{|definition| definition.name == name.to_sym} raise LiveActivity::InvalidActivity, "Could not find a definition for `#{name}`" else definition end end |
.register(definition) ⇒ Definition
Registers a new definition
24 25 26 27 28 29 |
# File 'lib/live_activity/definition.rb', line 24 def self.register(definition) return false unless definition.is_a? DefinitionDSL definition = new(definition) self.registered << definition return definition || false end |
.registered ⇒ Array<LiveActivity::Definition>
List of registered definitions
33 34 35 |
# File 'lib/live_activity/definition.rb', line 33 def self.registered @definitions ||= [] end |