Class: Cfruby::Parser
- Inherits:
-
Object
- Object
- Cfruby::Parser
- Includes:
- Cfp_ClassAccessor, Cfp_ParserLogic, CfrubyRuntime
- Defined in:
- lib/libcfenjin/parser.rb
Constant Summary
Constants included from Cfp_MapOptions
Cfp_MapOptions::AGE_OPT, Cfp_MapOptions::COPY, Cfp_MapOptions::DIR, Cfp_MapOptions::EMPTY_OPT, Cfp_MapOptions::FILES, Cfp_MapOptions::FILE_OPT, Cfp_MapOptions::MAP, Cfp_MapOptions::PATTERN_OPT, Cfp_MapOptions::RECURSE_OPT, Cfp_MapOptions::REMOVE_OPT, Cfp_MapOptions::SYNONYM, Cfp_MapOptions::TIDY
Instance Method Summary collapse
- #dump ⇒ Object
-
#form(action, *args) ⇒ Object
Just return the straight Ruby conversion.
-
#initialize(cf = nil) ⇒ Parser
constructor
Optionally pass in
Cfp_Stat
object. -
#method_missing(methId, line) ⇒ Object
Run a links command using Cfruby style syntax - generalised by the method_missing method:.
-
#run(action, *args) ⇒ Object
run
sends an action directly to the CfrubyRuntime mixed in module.
Methods included from Cfp_ParserLogic
#conditional?, #embed_exec_into_informer, #form_conditional, #form_control, #form_copy, #form_directories, #form_editfiles, #form_files, #form_groups, #form_links, #form_shellcommands, #form_tidy
Methods included from Cfp_ClassAccessor
#assign, #cfgroup, #dump_classlist, #init_classlist, #isa, #isa?
Methods included from CfrubyRuntime
#cfenjin_version, #copy, #directories, #exit_script, #files, #haspackage?, #hasuser?, #link, #needpackage, #package, #tidy
Methods included from Cfp_MapOptions
#check_pattern, #expand_synonyms, #map, #pop_options, #synonym
Constructor Details
#initialize(cf = nil) ⇒ Parser
Optionally pass in Cfp_Stat
object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/libcfenjin/parser.rb', line 20 def initialize cf=nil @global_names = Array.new if @cf != nil and cf != nil # print "PROBLEM\n" raise '@cf is already assigned in Parser!' end @cf = cf if cf != nil if @cf == nil # ---- Dummy assignment @cf = Cfp_Stat.new end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(methId, line) ⇒ Object
Run a links command using Cfruby style syntax - generalised by the method_missing method:
def links line
eval(form_links(line))
end
57 58 59 60 61 |
# File 'lib/libcfenjin/parser.rb', line 57 def method_missing methId,line raise "Can not find method '#{methId}'" if methId.to_s =~ /^form_/ Cfruby.controller.inform('verbose', "Calling user defined action form_#{methId}") eval(send('form_'+methId.to_s,line)) end |
Instance Method Details
#dump ⇒ Object
46 47 48 |
# File 'lib/libcfenjin/parser.rb', line 46 def dump Cfp_parser::dump end |
#form(action, *args) ⇒ Object
Just return the straight Ruby conversion
42 43 44 |
# File 'lib/libcfenjin/parser.rb', line 42 def form action, *args send 'form_'+action,*args end |
#run(action, *args) ⇒ Object
run
sends an action directly to the CfrubyRuntime mixed in module.
35 36 37 38 39 |
# File 'lib/libcfenjin/parser.rb', line 35 def run action,*args # print "Running #{action}" # p args send action,*args end |