Class: Interfacets::Server::Api
- Inherits:
-
Object
- Object
- Interfacets::Server::Api
- Defined in:
- lib/interfacets/server/api.rb
Instance Attribute Summary collapse
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
Instance Method Summary collapse
- #handle(event) ⇒ Object
-
#initialize(entity:, name:, registry:) ⇒ Api
constructor
A new instance of Api.
- #render ⇒ Object
Constructor Details
#initialize(entity:, name:, registry:) ⇒ Api
Returns a new instance of Api.
7 8 9 10 11 |
# File 'lib/interfacets/server/api.rb', line 7 def initialize(entity:, name:, registry:) @entity = entity @name = name @registry = registry end |
Instance Attribute Details
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
6 7 8 |
# File 'lib/interfacets/server/api.rb', line 6 def entity @entity end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/interfacets/server/api.rb', line 6 def name @name end |
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
6 7 8 |
# File 'lib/interfacets/server/api.rb', line 6 def registry @registry end |
Instance Method Details
#handle(event) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/interfacets/server/api.rb', line 13 def handle(event) Shared::Entities::Bus .new(entity:) .handle(event:) if entity.channel.rendered? entity.channel.render_facet else emit("after_#{event.fetch("action")}", nesting: event.fetch("nesting")) end end |
#render ⇒ Object
25 26 27 |
# File 'lib/interfacets/server/api.rb', line 25 def render emit("after_load", nesting: ["root"]) end |