module ENV

Overview

ENV is a hash-like accessor for environment variables.

Example

# Set env var PORT to a default if not already set
ENV["PORT"] ||= "5000"
# Later use that env var.
puts ENV["PORT"].to_i

NOTE All keys and values are strings. You must take care to cast other types at runtime, e.g. integer port numbers.

Extended Modules

Defined in:

py2cr/env.cr

Class Method Summary

Class Method Detail

def self.py_in?(key : String) : Bool #

Handles "key in os.environ" case


[View source]