Class: Giternal::YamlConfig
- Inherits:
-
Object
- Object
- Giternal::YamlConfig
- Defined in:
- lib/giternal/yaml_config.rb
Instance Method Summary collapse
- #each_repo ⇒ Object
- #find_repo(path) ⇒ Object
-
#initialize(base_dir, yaml_string) ⇒ YamlConfig
constructor
A new instance of YamlConfig.
Constructor Details
#initialize(base_dir, yaml_string) ⇒ YamlConfig
Returns a new instance of YamlConfig.
5 6 7 8 |
# File 'lib/giternal/yaml_config.rb', line 5 def initialize(base_dir, yaml_string) @base_dir = base_dir @config_hash = YAML.load yaml_string end |
Instance Method Details
#each_repo ⇒ Object
10 11 12 |
# File 'lib/giternal/yaml_config.rb', line 10 def each_repo repositories.each { |r| yield(r) if block_given? } end |
#find_repo(path) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/giternal/yaml_config.rb', line 14 def find_repo(path) @config_hash.each do |name, attributes| if path == File.join(attributes["path"], name) return Repository.new(@base_dir, name, attributes["repo"], attributes["path"]) end end return nil end |