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)


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

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



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

def __getobj__; @value; end

#enable?Boolean

Returns:

  • (Boolean)


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

def enable?   ; @value; end

#with_arg?Boolean

Returns:

  • (Boolean)


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

def with_arg? ; false ; end