Class: Ppr::LoadRequire

Inherits:
Macro
  • Object
show all
Defined in:
lib/ppr/ppr_core.rb

Overview

Descibes an abstract class for loading or requiring files.

Direct Known Subclasses

Load, Require

Constant Summary

Constants inherited from Macro

Macro::E_NUMBER, Macro::E_TYPE

Instance Attribute Summary

Attributes inherited from Macro

#name

Instance Method Summary collapse

Methods inherited from Macro

#add, #apply, e_message, #e_message, #e_number, #e_shift_number, #e_type?, #empty?, #final?, #generate, #to_quoted

Constructor Details

#initialize(num, ppr, expand: ":<") ⇒ LoadRequire

Creates a new load or require macro starting at line number num generated from preprocessor ppr.

The expand strings be redefined through keyword arguments.



301
302
303
# File 'lib/ppr/ppr_core.rb', line 301

def initialize(num, ppr, expand: ":<")
    super("",num,ppr,expand: expand)
end

Instance Method Details

#loadm(name) ⇒ Object

Loads and preprocess file name.



306
307
308
309
310
311
312
313
# File 'lib/ppr/ppr_core.rb', line 306

def loadm(name)
    output = StringIO.new("")
    # print "name=#{name}\n"
    File.open(name,"r") do |input|
        @ppr.preprocess(input,output)
    end
    return output.string
end