Class: Brash::CommandContext
- Inherits:
-
Object
- Object
- Brash::CommandContext
- Defined in:
- lib/brash.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(depth = 0) ⇒ CommandContext
constructor
A new instance of CommandContext.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(depth = 0) ⇒ CommandContext
Returns a new instance of CommandContext.
14 15 16 |
# File 'lib/brash.rb', line 14 def initialize(depth=0) @depth = depth end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
10 11 12 |
# File 'lib/brash.rb', line 10 def command @command end |
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
10 11 12 |
# File 'lib/brash.rb', line 10 def depth @depth end |
Class Method Details
.surround(*args, &block) ⇒ Object
17 18 19 20 21 |
# File 'lib/brash.rb', line 17 def self.surround(*args, &block) context = CommandContext.new(*args) context.instance_eval(&block) if block_given? context end |