Class: Middleman::GhPages::Command
- Inherits:
- BasicObject
- Defined in:
- lib/middleman/gh_pages/command.rb
Defined Under Namespace
Classes: Error
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cmd) ⇒ Command
constructor
A new instance of Command.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(cmd) ⇒ Command
Returns a new instance of Command.
23 24 25 |
# File 'lib/middleman/gh_pages/command.rb', line 23 def initialize(cmd) @cmd = cmd.to_s end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
27 28 29 30 31 |
# File 'lib/middleman/gh_pages/command.rb', line 27 def method_missing(name, *args, &block) unless ::Kernel.system(@cmd, name.to_s, *args.map(&:to_s)) ::Kernel.raise Error end end |
Class Method Details
.method_missing(name, *args, &block) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/middleman/gh_pages/command.rb', line 13 def method_missing(name, *args, &block) command = new(name) if args.empty? command else command.public_send(*args, &block) end end |