class Kramdown::PlantUml::BoolEnv
Converts envrionment variables to boolean values
Constants
- FALSEY_VALUES
- TRUTHY_VALUES
Public Class Methods
new(name)
click to toggle source
# File lib/kramdown-plantuml/bool_env.rb, line 10 def initialize(name) @name = name value = ENV.fetch(name, nil) @value = value.to_s.downcase unless value.nil? end
Public Instance Methods
true?()
click to toggle source
# File lib/kramdown-plantuml/bool_env.rb, line 16 def true? return true if TRUTHY_VALUES.include?(@value) return false if FALSEY_VALUES.include?(@value) || @value.nil? || value.empty? raise "The value '#{@value}' of '#{@name}' can't be converted to a boolean" end