Module: Hudkins::Command::Irb
- Defined in:
- lib/hudkins/command/irb_start.rb
Class Method Summary collapse
-
.extend_object(obj) ⇒ Object
In the irb console I want to access the same commands as Hudkins::Command::Exec but without the `run_' part.
Instance Method Summary collapse
-
#hudkins ⇒ Object
help method in irb console.
-
#method_missing(sym, *args, &block) ⇒ Object
This is cool.
-
#reload! ⇒ Object
helper method in irb console to reload all the lib files.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
This is cool. Override default method to add convenience methods for each job_name in #jobs. This allows `job_name' to be used as a method to access that particular job.
52 53 54 55 56 57 58 |
# File 'lib/hudkins/command/irb_start.rb', line 52 def method_missing sym, *args, &block if job = @hud.jobs.find_by_name( sym ) job else super sym, *args, &block end end |
Class Method Details
.extend_object(obj) ⇒ Object
In the irb console I want to access the same commands as Hudkins::Command::Exec but without the `run_' part.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/hudkins/command/irb_start.rb', line 37 def self.extend_object obj # :doc: # in IRB allow run_* commands to be exec without `run_' obj.command_list.each do |cmd| s = " def self.\#{cmd.gsub(/^run_/, '')} *args; \#{cmd} *args; end\n EOE\n obj.module_eval s\n end\n super\nend\n" |
Instance Method Details
#hudkins ⇒ Object
help method in irb console
62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/hudkins/command/irb_start.rb', line 62 def hudkins puts "\n self is Hudkins::Command\n hudkins => This help message\n reload! => reload lib\n hud => Hudkins.new <hud_host>\n job [job_name] => Hudkins::Job\n job_name => Hudkins::Job\n commands:\n\#{cmd_list.join(\"\\n \")}\n\n EOS\nend\n" |
#reload! ⇒ Object
helper method in irb console to reload all the lib files.
79 80 81 82 83 84 |
# File 'lib/hudkins/command/irb_start.rb', line 79 def reload! $".grep( /hudkins/ ).each do |f| load f end nil end |