Class: Marameters::Sources::Reader
- Inherits:
-
Object
- Object
- Marameters::Sources::Reader
- Defined in:
- lib/marameters/sources/reader.rb
Overview
Reads object source code from memory or file (assumes implementation is a one-liner).
Instance Method Summary collapse
- #call(object) ⇒ Object
-
#initialize(offset: 1, parser: RubyVM::InstructionSequence, io: File) ⇒ Reader
constructor
A new instance of Reader.
Constructor Details
#initialize(offset: 1, parser: RubyVM::InstructionSequence, io: File) ⇒ Reader
Returns a new instance of Reader.
7 8 9 10 11 12 13 14 15 |
# File 'lib/marameters/sources/reader.rb', line 7 def initialize offset: 1, parser: RubyVM::InstructionSequence, io: File warn "`#{self.class}` is deprecated, use `Sourcers::Readers::Any` instead.", category: :deprecated @offset = offset @parser = parser @io = io freeze end |
Instance Method Details
#call(object) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/marameters/sources/reader.rb', line 17 def call object instructions = parser.of object fail StandardError, "Unable to load source for: #{object.inspect}." unless instructions process object, instructions end |