Class: GerritEventRouter::Config
- Inherits:
-
Object
- Object
- GerritEventRouter::Config
- Defined in:
- lib/ger/config.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#brokers ⇒ Object
Returns the value of attribute brokers.
-
#gerrits ⇒ Object
Returns the value of attribute gerrits.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #load(path) ⇒ Object
- #names(to_yaml = true) ⇒ Object
Constructor Details
Instance Attribute Details
#brokers ⇒ Object
Returns the value of attribute brokers.
57 58 59 |
# File 'lib/ger/config.rb', line 57 def brokers @brokers end |
#gerrits ⇒ Object
Returns the value of attribute gerrits.
57 58 59 |
# File 'lib/ger/config.rb', line 57 def gerrits @gerrits end |
Instance Method Details
#load(path) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ger/config.rb', line 33 def load(path) open(path) do |stream| YAML.load_stream(stream, path) do |obj| if obj.instance_of?(GER::Gerrit::Config) @gerrits << obj elsif obj.kind_of?(GER::Broker::Config::Base) @brokers << obj end end end self end |
#names(to_yaml = true) ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ger/config.rb', line 46 def names(to_yaml = true) h = Hash.new h[:gerrit] = @gerrits.map {|item| item.name} h[:broker] = @brokers.map {|item| item.name} if to_yaml then YAML.dump(h) else h end end |