Sha256: b2cf073a1b83923dcd23b719595c3a1ab53806d8df3fe2c597f9379e5b607b16

Contents?: true

Size: 573 Bytes

Versions: 2

Compression:

Stored size: 573 Bytes

Contents

# -*- encoding: utf-8 -*-

module GitShizzle::Dsl
  class Dsl
    def initialize(commands)
      @commands = commands
    end

    def desc(description)
      @description = description
    end

    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

    private
    def reset_description
      @description = nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git_shizzle-0.2.8 lib/git_shizzle/dsl/dsl.rb
git_shizzle-0.2.6 lib/git_shizzle/dsl/dsl.rb