Class: Resque::Cluster::Config::File
- Inherits:
-
Pathname
- Object
- Pathname
- Resque::Cluster::Config::File
- Extended by:
- Forwardable
- Defined in:
- lib/resque/cluster/config/file.rb
Instance Method Summary collapse
Instance Method Details
#contents ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/resque/cluster/config/file.rb', line 27 def contents @contents ||= begin YAML.load(ERB.new(self.read).result) rescue => e errors << e. nil end end |
#errors ⇒ Object
23 24 25 |
# File 'lib/resque/cluster/config/file.rb', line 23 def errors @errors ||= Set.new end |
#exist? ⇒ Boolean
9 10 11 |
# File 'lib/resque/cluster/config/file.rb', line 9 def exist? super.tap { |exists| errors << "Configuration file doesn't exist" unless exists } end |
#valid? ⇒ Boolean
13 14 15 16 17 18 19 20 21 |
# File 'lib/resque/cluster/config/file.rb', line 13 def valid? if contents.is_a?(Hash) errors << "Config file is empty" unless contents.any? else errors << "Parsed config as invalid type: expected Hash, got #{contents.class}" end contents.is_a?(Hash) && contents.any? end |