Sha256: e383f5f0011a617bc2c3682efef08af0260c764bd55b02e76c9c02e95c4d48d4

Contents?: true

Size: 716 Bytes

Versions: 2

Compression:

Stored size: 716 Bytes

Contents

#          Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

module Ramaze
  CLIOption = Struct.new('CLIOption', :name, :default, :doc, :cli)
  OPTIONS     = {}
  CLI_OPTIONS = []

  module GlobalDSL
    class << self
      def option_dsl(&block)
        instance_eval(&block)
      end

      def o(doc, options = {})
        cli_given = options.has_key?(:cli)
        cli = options.delete(:cli)
        name, default = options.to_a.flatten

        if cli_given
          option = CLIOption.new(name, default, doc, cli)
          CLI_OPTIONS << option
        end

        OPTIONS.merge!(options)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ramaze-0.1.1 lib/ramaze/global/dsl.rb
ramaze-0.1.2 lib/ramaze/global/dsl.rb