Class: Pantry::ClientInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/pantry/client_info.rb

Overview

Simple class to keep track of a given client’s identifying information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application: nil, environment: nil, roles: [], identity: nil) ⇒ ClientInfo

Returns a new instance of ClientInfo.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/pantry/client_info.rb', line 20

def initialize(application: nil, environment: nil, roles: [], identity: nil)
  @application = application
  @environment = environment
  @roles       = roles
  @identity    = identity

  @filter = Pantry::Communication::ClientFilter.new(
    application: @application,
    environment: @environment,
    roles:       @roles,
    identity:    @identity
  )
end

Instance Attribute Details

#applicationObject (readonly)

Returns the value of attribute application.



5
6
7
# File 'lib/pantry/client_info.rb', line 5

def application
  @application
end

#environmentObject (readonly)

Returns the value of attribute environment.



7
8
9
# File 'lib/pantry/client_info.rb', line 7

def environment
  @environment
end

#filterObject (readonly)

The above gets packaged into a ClientFilter for use elsewhere



12
13
14
# File 'lib/pantry/client_info.rb', line 12

def filter
  @filter
end

#identityObject (readonly)

This client’s current identity. By default a client’s identity is it’s ‘hostname`, but a specific one can be given. These identities should be unique across the set of clients connecting to a single Pantry Server, behavior of multiple clients with the same identity is currently undefined.



18
19
20
# File 'lib/pantry/client_info.rb', line 18

def identity
  @identity
end

#rolesObject (readonly)

Returns the value of attribute roles.



9
10
11
# File 'lib/pantry/client_info.rb', line 9

def roles
  @roles
end