Class: Play::Office

Inherits:
Object
  • Object
show all
Defined in:
lib/play/office.rb

Class Method Summary collapse

Class Method Details

.urlObject

The URL we can check to come up with the list of users in the office.

Returns the String configuration value for ‘office_url`.



30
31
32
# File 'lib/play/office.rb', line 30

def self.url
  Play.config['office_url']
end

.user_stringObject

Hits the URL that we’ll use to identify users.

Returns a String of users (hopefully in comma-separated format).



21
22
23
24
25
# File 'lib/play/office.rb', line 21

def self.user_string
  open(url).read
rescue Exception
  nil
end

.usersObject

The users currently present in the office.

Returns an Array of User objects.



8
9
10
11
12
13
14
15
16
# File 'lib/play/office.rb', line 8

def self.users
  string_cache = user_string
  return unless string_cache
  users = []
  string_cache.split(',').each do |string|
    users << User.find_by_office_string(string.downcase)
  end
  users.compact
end