Sha256: 8cfd2eda5a83b9ec6eda6f515f2d0d6a5bfc132f15586631a69a8c1a6762d845

Contents?: true

Size: 463 Bytes

Versions: 1

Compression:

Stored size: 463 Bytes

Contents

# frozen_string_literal: true

# Added methods to boolean module
module BooleanHelper
  def to_yn(capital_letter: true)
    if self
      capital_letter ? 'Y' : 'y'
    else
      capital_letter ? 'N' : 'n'
    end
  end

  def to_yes_no(capital_letter: false)
    if self
      capital_letter ? 'YES' : 'yes'
    else
      capital_letter ? 'NO' : 'no'
    end
  end
end

class TrueClass
  include BooleanHelper
end

class FalseClass
  include BooleanHelper
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
render-text-helper-0.1.0 lib/render/text/helper/boolean.rb