Sha256: a6389b496224df4a2638105d20f6a3080b69e4d6a7d9dc1c1f1a94b7da0098a3

Contents?: true

Size: 604 Bytes

Versions: 27

Compression:

Stored size: 604 Bytes

Contents

# frozen_string_literal: true

require 'eac_cli/definition/base_option'

module EacCli
  class Definition
    class BooleanOption < ::EacCli::Definition::BaseOption
      def argument?
        false
      end

      def build_value(_new_value, previous_value)
        repeat? ? previous_value + 1 : true
      end

      def default_value
        return super unless default_value?

        raise(::EacCli::Definition::Error,
              "Unallowed default value for boolean options (Option: #{self})")
      end

      def default_default_value
        repeat? ? 0 : false
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
eac_tools-0.81.0 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.80.0 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.79.0 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.78.0 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.77.1 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.77.0 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_cli-0.38.0 lib/eac_cli/definition/boolean_option.rb
eac_tools-0.76.1 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.76.0 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.75.2 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_cli-0.37.0 lib/eac_cli/definition/boolean_option.rb
eac_tools-0.75.1 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.75.0 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.74.1 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.74.0 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_cli-0.36.0 lib/eac_cli/definition/boolean_option.rb
eac_tools-0.73.0 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.72.0 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.70.1 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb
eac_tools-0.70.0 sub/eac_cli/lib/eac_cli/definition/boolean_option.rb