Class: Streama::Definition
- Inherits:
-
Object
- Object
- Streama::Definition
- Defined in:
- lib/streama/definition.rb
Instance Attribute Summary collapse
-
#actor ⇒ Object
readonly
Returns the value of attribute actor.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#receivers ⇒ Object
readonly
Returns the value of attribute receivers.
-
#target_object ⇒ Object
readonly
Returns the value of attribute target_object.
Class Method Summary collapse
- .find(name) ⇒ Object
-
.register(definition) ⇒ Definition
Registers a new definition.
-
.registered ⇒ Array<Streama::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 |
# File 'lib/streama/definition.rb', line 8 def initialize(definition) @name = definition[:name] @actor = definition[:actor] || {} @object = definition[:object] || {} @target_object = definition[:target_object] || {} end |
Instance Attribute Details
#actor ⇒ Object (readonly)
Returns the value of attribute actor.
5 6 7 |
# File 'lib/streama/definition.rb', line 5 def actor @actor end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/streama/definition.rb', line 5 def name @name end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
5 6 7 |
# File 'lib/streama/definition.rb', line 5 def object @object end |
#receivers ⇒ Object (readonly)
Returns the value of attribute receivers.
5 6 7 |
# File 'lib/streama/definition.rb', line 5 def receivers @receivers end |
#target_object ⇒ Object (readonly)
Returns the value of attribute target_object.
5 6 7 |
# File 'lib/streama/definition.rb', line 5 def target_object @target_object end |
Class Method Details
.find(name) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/streama/definition.rb', line 33 def self.find(name) unless definition = registered.find{|definition| definition.name == name.to_sym} raise Streama::Errors::InvalidActivity, "Could not find a definition for `#{name}`" else definition end end |
.register(definition) ⇒ Definition
Registers a new definition
20 21 22 23 24 25 |
# File 'lib/streama/definition.rb', line 20 def self.register(definition) return false unless definition.is_a? DefinitionDSL definition = new(definition) self.registered << definition return definition || false end |
.registered ⇒ Array<Streama::Definition>
List of registered definitions
29 30 31 |
# File 'lib/streama/definition.rb', line 29 def self.registered @definitions ||= [] end |