Class: RD::RBLSuite
- Inherits:
-
Object
- Object
- RD::RBLSuite
- Defined in:
- lib/rd/rbl-suite.rb
Instance Attribute Summary collapse
-
#rbl_files ⇒ Object
readonly
Returns the value of attribute rbl_files.
Instance Method Summary collapse
- #add_rbl_file(filename) ⇒ Object
- #get_rbl_file(filename) ⇒ Object
-
#initialize(search_paths) ⇒ RBLSuite
constructor
A new instance of RBLSuite.
- #refer(label, filename) ⇒ Object
Constructor Details
#initialize(search_paths) ⇒ RBLSuite
Returns a new instance of RBLSuite.
7 8 9 10 |
# File 'lib/rd/rbl-suite.rb', line 7 def initialize(search_paths) @search_paths = search_paths @rbl_files = [] end |
Instance Attribute Details
#rbl_files ⇒ Object (readonly)
Returns the value of attribute rbl_files.
5 6 7 |
# File 'lib/rd/rbl-suite.rb', line 5 def rbl_files @rbl_files end |
Instance Method Details
#add_rbl_file(filename) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rd/rbl-suite.rb', line 26 def add_rbl_file(filename) rbl = RBLFile.new(filename) begin rbl.load_rbl_file(@search_paths) rescue RuntimeError ensure @rbl_files.push(rbl) end rbl end |
#get_rbl_file(filename) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/rd/rbl-suite.rb', line 17 def get_rbl_file(filename) rbl = @rbl_files.find{|i| i.filename == RBLFile.basename(filename)} if rbl rbl else add_rbl_file(filename) end end |
#refer(label, filename) ⇒ Object
12 13 14 15 |
# File 'lib/rd/rbl-suite.rb', line 12 def refer(label, filename) rbl = get_rbl_file(filename) [rbl.filename, rbl.refer(label)] end |