Created
August 27, 2015 01:15
-
-
Save debajit/0aed54eea159714558dc to your computer and use it in GitHub Desktop.
Call method when defining Ruby constant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Updater | |
METADATA_FILE = self.class.file_path | |
def initialize | |
METADATA_FILE | |
end | |
def self.file_path | |
'some file path' | |
end | |
end | |
Updater.new # => | |
# ~> -:2:in `<class:Updater>': undefined method `file_path' for Class:Class (NoMethodError) | |
# ~> from -:1:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can I call the file_path method when defining the METADATA_FILE constant?