Class: Purdie::Bernard
- Inherits:
-
Object
- Object
- Purdie::Bernard
- Defined in:
- lib/purdie/bernard.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#fetch ⇒ Object
def source_file= path @sources = path end.
-
#initialize ⇒ Bernard
constructor
A new instance of Bernard.
Constructor Details
#initialize ⇒ Bernard
Returns a new instance of Bernard.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/purdie/bernard.rb', line 7 def initialize @config = Config.instance.config begin @sources = Dir.entries(@config['source_dir']).select { |e| e !~ /^\./ }.map { |s| "#{@config['source_dir']}/#{s}" } rescue Errno::ENOENT @sources = nil end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/purdie/bernard.rb', line 5 def config @config end |
Instance Method Details
#fetch ⇒ Object
def source_file= path
@sources = path
end
24 25 26 27 28 29 30 |
# File 'lib/purdie/bernard.rb', line 24 def fetch raise PurdieException.new 'No data sources specified' unless @sources @sources.map { |s| SourceList.from_file s }.each do |source| source.write end end |