Class: Decode::Source
- Inherits:
-
Object
- Object
- Decode::Source
- Defined in:
- lib/decode/source.rb
Instance Method Summary collapse
-
#initialize(path, language = nil) ⇒ Source
constructor
A new instance of Source.
- #open(&block) ⇒ Object
- #parse(&block) ⇒ Object
Constructor Details
Instance Method Details
#open(&block) ⇒ Object
38 39 40 |
# File 'lib/decode/source.rb', line 38 def open(&block) File.open(@path, &block) end |
#parse(&block) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/decode/source.rb', line 30 def parse(&block) return to_enum(:parse) unless block_given? self.open do |file| @language.parse(file, &block) end end |