Class: Ppr::Assign
Overview
Describes an assignment macro of the ruby preprocessor.
Constant Summary
Constants inherited from Macro
Macro::E_NUMBER, Macro::E_TYPE
Instance Attribute Summary
Attributes inherited from Macro
Instance Method Summary collapse
-
#apply(i_number) ⇒ Object
Applies the macro invoked at line number
i_number
, its result in assigned to the class variable. -
#initialize(name, num, ppr, expand: ":<") ⇒ Assign
constructor
Creates a new assignment macro whose assigned variable is
var
, starting at line numbernum
generated from preprocessorppr
.
Methods inherited from Macro
#add, e_message, #e_message, #e_number, #e_shift_number, #e_type?, #empty?, #final?, #generate, #to_quoted
Constructor Details
#initialize(name, num, ppr, expand: ":<") ⇒ Assign
Creates a new assignment macro whose assigned variable is var
, starting at line number num
generated from preprocessor ppr
.
Other parameters:
expand
-
redefines the expand operator string.
276 277 278 279 280 |
# File 'lib/ppr/ppr_core.rb', line 276 def initialize(name, num, ppr, expand: ":<") super(name,num,ppr,expand: ) # Creates the attribute which will be assigned. @var_sym = Ppr.to_attribute(name) end |
Instance Method Details
#apply(i_number) ⇒ Object
Applies the macro invoked at line number i_number
, its result in assigned to the class variable.
284 285 286 287 288 289 290 291 |
# File 'lib/ppr/ppr_core.rb', line 284 def apply(i_number) # Expands the macro. line = super(i_number) # Assign the result to the variable. @ppr.parameter_set(@var_sym,line) # No modification of the output file, so return an empty string. return "" end |