Class: ConfConf::Project::Environments

Inherits:
Struct
  • Object
show all
Defined in:
lib/conf_conf/project/environments.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#projectObject

Returns the value of attribute project



3
4
5
# File 'lib/conf_conf/project/environments.rb', line 3

def project
  @project
end

Instance Method Details

#[](name) ⇒ Object



19
20
21
# File 'lib/conf_conf/project/environments.rb', line 19

def [](name)
  Environment.load(project, name)
end

#lengthObject



4
5
6
# File 'lib/conf_conf/project/environments.rb', line 4

def length
  Dir["config/conf_conf/environments/*.json"].length
end

#remove(name) ⇒ Object



8
9
10
# File 'lib/conf_conf/project/environments.rb', line 8

def remove(name)
  FileUtils.rm_f("config/conf_conf/environments/#{name}.json")
end

#to_aObject



12
13
14
15
16
17
# File 'lib/conf_conf/project/environments.rb', line 12

def to_a
  Dir["config/conf_conf/environments/*.json"].collect do |path|
    environment_name = File.basename(path, File.extname(path))
    self[environment_name]
  end
end