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.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/psd.rb', line 37 def self.open(filename, opts={}, &block) psd = PSD.new(filename, opts) psd.parse! return psd unless block_given? if 0 == block.arity psd.instance_eval(&block) else yield psd end ensure psd.close if psd end |