Class: MissionControl::Web::Application

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, Routes
Defined in:
app/models/mission_control/web/application.rb

Defined Under Namespace

Modules: Routes

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Routes

#route_disabled?, #route_was_deleted, #route_was_updated, #routes

Instance Attribute Details

#nameObject

Returns the value of attribute name.



5
6
7
# File 'app/models/mission_control/web/application.rb', line 5

def name
  @name
end

#redisObject

Returns the value of attribute redis.



5
6
7
# File 'app/models/mission_control/web/application.rb', line 5

def redis
  @redis
end

Class Method Details

.allObject



8
9
10
# File 'app/models/mission_control/web/application.rb', line 8

def all
  MissionControl::Web.configuration.administered_applications.map { |app| new(**app) }
end

.defaultObject



24
25
26
# File 'app/models/mission_control/web/application.rb', line 24

def default
  all.first or raise MissionControl::Web::Errors::ResourceNotFound
end

.find(id) ⇒ Object



12
13
14
# File 'app/models/mission_control/web/application.rb', line 12

def find(id)
  all.find { |application| application.id == id }
end

.find!(id) ⇒ Object



16
17
18
# File 'app/models/mission_control/web/application.rb', line 16

def find!(id)
  find(id) or raise MissionControl::Web::Errors::ResourceNotFound
end

.find_or_initialize_by_name(name) ⇒ Object



20
21
22
# File 'app/models/mission_control/web/application.rb', line 20

def find_or_initialize_by_name(name)
  find(name.parameterize) || new(name: name)
end

Instance Method Details

#idObject Also known as: to_param



29
30
31
# File 'app/models/mission_control/web/application.rb', line 29

def id
  name.parameterize
end