Class: HTML2FB::Conf

Inherits:
Object
  • Object
show all
Defined in:
lib/Html2Feedbooks/conf.rb

Instance Method Summary collapse

Constructor Details

#initialize(file, conv) ⇒ Conf

Returns a new instance of Conf.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/Html2Feedbooks/conf.rb', line 5

def initialize(file,conv)
  ['','./',"#{File.dirname(__FILE__)}/","#{File.dirname(__FILE__)}/../confs/"].each do |p|
    f=p+file
    begin
      if File.readable?(f) && File.exists?(f)
        @conf=File.open(f,'r'){|txt| YAML::load(txt)}
        puts "loaded config file : "+f
        @conf['conv']=conv
        return 
      end
    rescue Exception => e 
      STDERR.puts('unreadable conf : '+f+"\n"+e)
    end
  end
end

Instance Method Details

#[](x) ⇒ Object



21
22
23
# File 'lib/Html2Feedbooks/conf.rb', line 21

def [](x)
  @conf[x]
end

#to_hObject



25
26
27
# File 'lib/Html2Feedbooks/conf.rb', line 25

def to_h
  @conf
end