Class: GitShizzle::Dsl::CommandContext

Inherits:
Object
  • Object
show all
Defined in:
lib/git_shizzle/dsl/command_context.rb

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ CommandContext

Returns a new instance of CommandContext.



5
6
7
# File 'lib/git_shizzle/dsl/command_context.rb', line 5

def initialize(command)
  @command = command
end

Instance Method Details

#action(&block) ⇒ Object



14
15
16
17
# File 'lib/git_shizzle/dsl/command_context.rb', line 14

def action(&block)
  raise CommandDefinitionError.new(@command, '#action requires a block.') unless block_given?
  @command.set_action block
end

#applies_to(&block) ⇒ Object



9
10
11
12
# File 'lib/git_shizzle/dsl/command_context.rb', line 9

def applies_to(&block)
  raise CommandDefinitionError.new(@command, '#applies_to requires a block.') unless block_given?
  @command.set_filter block
end