Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Use const_missing instead of defining every time constant manually. #1

Open
postmodern opened this Issue · 2 comments

2 participants

Postmodern Ryan King
Postmodern

You could use const_missing to dynamically return values for time constants, without having to manually define every single time constant. Additionally you could call const_set or memoize the values with a lazy Hash.

Ryan King

The whole point is to avoid methods.

Postmodern

If you use const_set with const_missing, const_missing will only be called once per time constant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.