Module: Quickl
- Defined in:
- lib/quickl.rb,
lib/quickl/errors.rb,
lib/quickl/naming.rb,
lib/quickl/command.rb,
lib/quickl/ruby_tools.rb,
lib/quickl/command/single.rb,
lib/quickl/command/builder.rb,
lib/quickl/command/options.rb,
lib/quickl/command/delegator.rb,
lib/quickl/command/robustness.rb
Defined Under Namespace
Modules: Naming, RubyTools Classes: Command, Error, Exit, Help, IOAccessError, InvalidArgument, InvalidOption, NoSuchCommand
Constant Summary collapse
- VERSION =
Quickl’s VERSION
'0.2.0'.freeze
- COPYRIGHT =
Quickl’s COPYRIGHT info
"(c) 2010, Bernard Lambeau"
Class Method Summary collapse
-
.build_command(command) ⇒ Object
Builds command using the current builder.
-
.Command(*args) ⇒ Object
Create a single command.
-
.command_builder {|@builder| ... } ⇒ Object
Yields the block with the current command builder.
- .Delegate(*args) ⇒ Object
-
.Delegator(*args) ⇒ Object
Create a delegator command.
Class Method Details
.build_command(command) ⇒ Object
Builds command using the current builder.
The current command builder is considered consumed and removed as a side effect. A RuntimeError is raised if no builder is currently installed.
Returns the command itself.
This method is part of Quickl’s private interface.
37 38 39 40 41 42 43 44 45 |
# File 'lib/quickl.rb', line 37 def self.build_command(command) unless @builder raise "No command builder currently installed" else @builder.run(command) @builder = nil command end end |
.Command(*args) ⇒ Object
Create a single command
19 20 21 22 23 24 25 |
# File 'lib/quickl/command/single.rb', line 19 def self.Command(*args) command_builder do |b| b.document *args b.instance_module Command::Single end Command end |
.command_builder {|@builder| ... } ⇒ Object
Yields the block with the current command builder. A fresh new builder is created if not already done.
This method is part of Quickl’s private interface.
20 21 22 23 24 |
# File 'lib/quickl.rb', line 20 def self.command_builder @builder ||= Command::Builder.new yield @builder if block_given? @builder end |
.Delegate(*args) ⇒ Object
54 55 56 |
# File 'lib/quickl/command/delegator.rb', line 54 def self.Delegate(*args) self.Delegator(*args) end |
.Delegator(*args) ⇒ Object
Create a delegator command
44 45 46 47 48 49 50 51 |
# File 'lib/quickl/command/delegator.rb', line 44 def self.Delegator(*args) command_builder do |b| b.document *args b.class_module Command::Delegator::ClassMethods b.instance_module Command::Delegator::InstanceMethods end Command end |