Class: Happn::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/happn/query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#emitterObject (readonly)

Returns the value of attribute emitter.



4
5
6
# File 'lib/happn/query.rb', line 4

def emitter
  @emitter
end

#kindObject (readonly)

Returns the value of attribute kind.



4
5
6
# File 'lib/happn/query.rb', line 4

def kind
  @kind
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/happn/query.rb', line 4

def name
  @name
end

#statusObject (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_keyObject



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