Module: Lazier::Boolean

Extended by:
ActiveSupport::Concern
Defined in:
lib/lazier/boolean.rb

Overview

Extension for the boolean values.

Instance Method Summary (collapse)

Instance Method Details

- (Fixnum) to_i

Converts the boolean to an integer.

Returns:

  • (Fixnum)

    1 for true, 0 for false.



15
16
17
# File 'lib/lazier/boolean.rb', line 15

def to_i
  is_a?(TrueClass) ? 1 : 0
end

- (Boolean) value

Returns the boolean itself for use in form helpers.

Returns:



22
23
24
# File 'lib/lazier/boolean.rb', line 22

def value
  self
end