Sha256: aa6c945e0c95e5a07b1ca9eaaf1d21df90102acad35f66b00fa936093fd55ef5

Contents?: true

Size: 579 Bytes

Versions: 7

Compression:

Stored size: 579 Bytes

Contents

module Commander
  module Patches
    module OptionDefaults
      # I can't remember what this patch does, but I found it in the code
      # base. It is better if this magic is kept separate
      def option(*args, &block)
        default = nil
        args.delete_if do |v|
          if v.is_a?(Hash) && v.key?(:default)
            default = v[:default]
            true
          else
            false
          end
        end
        opt = super
        opt.tap do |h|
          h.merge!( { default: default } ) unless default.nil?
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
commander-openflighthpc-2.0.0 lib/commander/patches/option_defaults.rb
commander-openflighthpc-1.2.0 lib/commander/patches/option_defaults.rb
commander-openflighthpc-1.1.2 lib/commander/patches/option_defaults.rb
commander-openflighthpc-1.1.1 lib/commander/patches/option_defaults.rb
commander-openflighthpc-1.1.0 lib/commander/patches/option_defaults.rb
commander-openflighthpc-1.0.0 lib/commander/patches/option_defaults.rb
commander-openflighthpc-1.0.0.pre.alpha1 lib/commander/patches/option_defaults.rb