Class: Rudachi::Option::BooleanOption

Inherits:
Delegator
  • Object
show all
Defined in:
lib/rudachi/option/boolean_option.rb

Instance Method Summary collapse

Constructor Details

#initialize(bool) ⇒ BooleanOption

Returns a new instance of BooleanOption.

Raises:

  • (ArgumentError)


4
5
6
7
# File 'lib/rudachi/option/boolean_option.rb', line 4

def initialize(bool)
  raise ArgumentError, 'must be `false` or `true`' unless bool.is_a?(FalseClass) || bool.is_a?(TrueClass)
  @value = bool
end

Instance Method Details

#__getobj__Object



9
# File 'lib/rudachi/option/boolean_option.rb', line 9

def __getobj__; @value; end

#enable?Boolean

Returns:

  • (Boolean)


10
# File 'lib/rudachi/option/boolean_option.rb', line 10

def enable?   ; @value; end

#with_arg?Boolean

Returns:

  • (Boolean)


11
# File 'lib/rudachi/option/boolean_option.rb', line 11

def with_arg? ; false ; end