Sha256: 0ef47fc6f09f1cf7a7d1b95eac9143cf3612d9ac365618446c16185b027a974a
Contents?: true
Size: 852 Bytes
Versions: 9
Compression:
Stored size: 852 Bytes
Contents
module PictureTag module Instructions # There are a few config settings which are environment dependent, and can # either be booleans, environment names, or arrays of environment names. # This class works it out and returns a boolean. class EnvInstruction < Instruction private def coerce get_bool(source) end def get_bool(value) case value when true, false, nil then value when String then value == PictureTag.jekyll_env when Array then value.include? PictureTag.jekyll_env when Hash then get_bool(value[:setting]) else raise ArgumentError, error_message end end def error_message "JPT - #{setting_name} must be a boolean, an environment name," \ ' or an array of environment names.' end end end end
Version data entries
9 entries across 9 versions & 1 rubygems