Class: Happn::Query
- Inherits:
-
Object
- Object
- Happn::Query
- Defined in:
- lib/happn/query.rb
Instance Attribute Summary collapse
-
#emitter ⇒ Object
readonly
Returns the value of attribute emitter.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(emitter, kind, name, status) ⇒ Query
constructor
A new instance of Query.
- #to_routing_key ⇒ Object
Constructor Details
#initialize(emitter, kind, name, status) ⇒ Query
Returns a new instance of Query.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/happn/query.rb', line 6 def initialize(emitter, kind, name, status) if emitter.to_s.include?(".") || kind.to_s.include?(".") || name.to_s.include?(".") || status.to_s.include?(".") raise "'Dot' is not a valid character" end @emitter = emitter @kind = kind @name = name @status = status end |
Instance Attribute Details
#emitter ⇒ Object (readonly)
Returns the value of attribute emitter.
4 5 6 |
# File 'lib/happn/query.rb', line 4 def emitter @emitter end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
4 5 6 |
# File 'lib/happn/query.rb', line 4 def kind @kind end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/happn/query.rb', line 4 def name @name end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/happn/query.rb', line 4 def status @status end |
Instance Method Details
#to_routing_key ⇒ Object
17 18 19 |
# File 'lib/happn/query.rb', line 17 def to_routing_key "#{to_expression(@status)}.#{to_expression(@emitter)}.#{to_expression(@kind)}.#{to_expression(@name)}" end |