Class: GitShizzle::Dsl::Dsl

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

Instance Method Summary collapse

Constructor Details

#initialize(commands) ⇒ Dsl

Returns a new instance of Dsl.



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

def initialize(commands)
  @commands = commands
end

Instance Method Details

#command(identifier, &block) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/git_shizzle/dsl/dsl.rb', line 13

def command(identifier, &block)
  raise CommandDefinitionError.new(identifier, '#command requires a block.') unless block_given?

  command = Command.new(identifier, @description, block)
  @commands.add_command(command)

  reset_description
end

#desc(description) ⇒ Object



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

def desc(description)
  @description = description
end