Class: Heroku::Helpers::HerokuPostgresql::Attachment

Inherits:
Object
  • Object
show all
Defined in:
lib/heroku/helpers/heroku_postgresql.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Attachment

Returns a new instance of Attachment.



10
11
12
13
14
15
16
# File 'lib/heroku/helpers/heroku_postgresql.rb', line 10

def initialize(raw)
  @raw = raw
  @config_var    = raw['config_var']
  @resource_name = raw['resource']['name']
  @url           = raw['resource']['value']
  @addon, @plan  = raw['resource']['type'].split(':')
end

Instance Attribute Details

#addonObject (readonly)

Returns the value of attribute addon.



9
10
11
# File 'lib/heroku/helpers/heroku_postgresql.rb', line 9

def addon
  @addon
end

#config_varObject (readonly)

Returns the value of attribute config_var.



9
10
11
# File 'lib/heroku/helpers/heroku_postgresql.rb', line 9

def config_var
  @config_var
end

#planObject (readonly)

Returns the value of attribute plan.



9
10
11
# File 'lib/heroku/helpers/heroku_postgresql.rb', line 9

def plan
  @plan
end

#resource_nameObject (readonly)

Returns the value of attribute resource_name.



9
10
11
# File 'lib/heroku/helpers/heroku_postgresql.rb', line 9

def resource_name
  @resource_name
end

#urlObject (readonly)

Returns the value of attribute url.



9
10
11
# File 'lib/heroku/helpers/heroku_postgresql.rb', line 9

def url
  @url
end

Instance Method Details

#display_nameObject



22
23
24
# File 'lib/heroku/helpers/heroku_postgresql.rb', line 22

def display_name
  config_var + (primary_attachment? ? " (DATABASE_URL)"  : '')
end

#primary_attachment!Object



26
27
28
# File 'lib/heroku/helpers/heroku_postgresql.rb', line 26

def primary_attachment!
  @primary_attachment = true
end

#primary_attachment?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/heroku/helpers/heroku_postgresql.rb', line 30

def primary_attachment?
  @primary_attachment
end

#starter_plan?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/heroku/helpers/heroku_postgresql.rb', line 18

def starter_plan?
  plan =~ /dev|basic/
end