Module: CSVPlusPlus::CanDefineReferences
- Included in:
- Scope
- Defined in:
- lib/csv_plus_plus/can_define_references.rb
Overview
Methods for classes that need to manage @variables and @functions
Instance Method Summary collapse
-
#def_function(id, entity) ⇒ Object
Define a (or re-define an existing) function.
-
#def_variable(id, entity) ⇒ Object
Define a (or re-define an existing) variable.
-
#def_variables(vars) ⇒ Object
Define (or re-define existing) variables.
-
#defined_function?(fn_id) ⇒ boolean
Is the function defined?.
-
#defined_variable?(var_id) ⇒ boolean
Is the variable defined?.
-
#verbose_summary ⇒ String
Provide a summary of the functions and variables compiled (to show in verbose mode).
Instance Method Details
#def_function(id, entity) ⇒ Object
Define a (or re-define an existing) function
25 26 27 |
# File 'lib/csv_plus_plus/can_define_references.rb', line 25 def def_function(id, entity) functions[id.to_sym] = entity end |
#def_variable(id, entity) ⇒ Object
Define a (or re-define an existing) variable
10 11 12 |
# File 'lib/csv_plus_plus/can_define_references.rb', line 10 def def_variable(id, entity) variables[id.to_sym] = entity end |
#def_variables(vars) ⇒ Object
Define (or re-define existing) variables
17 18 19 |
# File 'lib/csv_plus_plus/can_define_references.rb', line 17 def def_variables(vars) vars.each { |id, entity| def_variable(id, entity) } end |
#defined_function?(fn_id) ⇒ boolean
Is the function defined?
43 44 45 |
# File 'lib/csv_plus_plus/can_define_references.rb', line 43 def defined_function?(fn_id) functions.key?(fn_id.to_sym) end |
#defined_variable?(var_id) ⇒ boolean
Is the variable defined?
34 35 36 |
# File 'lib/csv_plus_plus/can_define_references.rb', line 34 def defined_variable?(var_id) variables.key?(var_id.to_sym) end |
#verbose_summary ⇒ String
Provide a summary of the functions and variables compiled (to show in verbose mode)
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/csv_plus_plus/can_define_references.rb', line 50 def verbose_summary <<~SUMMARY # Code Section Summary ## Resolved Variables #{variable_summary} ## Functions #{function_summary} SUMMARY end |