Method: PSD.open
- Defined in:
- lib/psd.rb
.open(filename, opts = {}, &block) ⇒ PSD
Opens the named file, parses it, and makes it available for reading. Then, closes it after you’re finished.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/psd.rb', line 42 def self.open(filename, opts={}, &block) raise "Must supply a block. Otherwise, use PSD.new." unless block_given? psd = PSD.new(filename, opts) psd.parse! if 0 == block.arity psd.instance_eval(&block) else yield psd end ensure psd.close if psd end |