Class: Purdie::Bernard
- Inherits:
-
Object
- Object
- Purdie::Bernard
- Defined in:
- lib/purdie/bernard.rb
Instance Attribute Summary collapse
-
#verbose ⇒ Object
Returns the value of attribute verbose.
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.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/purdie/bernard.rb', line 5 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
#verbose ⇒ Object
Returns the value of attribute verbose.
3 4 5 |
# File 'lib/purdie/bernard.rb', line 3 def verbose @verbose end |
Instance Method Details
#fetch ⇒ Object
def source_file= path
@sources = path
end
22 23 24 25 26 27 28 |
# File 'lib/purdie/bernard.rb', line 22 def fetch raise PurdieException.new 'No data sources specified' unless @sources @sources.map { |s| SourceList.from_file s, @verbose }.each do |source| source.write end end |