Class: Chapp::App

Inherits:
Object
  • Object
show all
Defined in:
lib/chapp/app.rb

Direct Known Subclasses

NodeApp

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, attributes, instances, db) ⇒ App

Returns a new instance of App.



9
10
11
12
13
14
15
16
# File 'lib/chapp/app.rb', line 9

def initialize id, attributes, instances, db
  @id = id
  @db = db
  @attributes = attributes
  @instances = instances
  @config = nil
  @connected_apps = nil
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



7
8
9
# File 'lib/chapp/app.rb', line 7

def attributes
  @attributes
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/chapp/app.rb', line 7

def id
  @id
end

#instancesObject (readonly)

Returns the value of attribute instances.



7
8
9
# File 'lib/chapp/app.rb', line 7

def instances
  @instances
end

Instance Method Details

#configObject



18
19
20
21
22
23
24
# File 'lib/chapp/app.rb', line 18

def config
  unless @config
    @config = @db.app_config @id
  end

  @config
end

#connected_appsObject



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/chapp/app.rb', line 26

def connected_apps
  unless @connected_apps
    @connected_apps = Array.new

    @db.connected_app_ids(@id).each do |app_id|
      @connected_apps << @db.app(app_id)
    end
  end

  @connected_apps
end