Created
June 10, 2014 22:10
-
-
Save matsumonkie/265221039784e855ef14 to your computer and use it in GitHub Desktop.
module functions
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
#---------------------------------------------------------------------- | |
module Util | |
module StringFormatter | |
module_function | |
def prettry_string(string) | |
"-> [#{string}] <-" | |
end | |
end | |
end | |
#---------------------------------------------------------------------- | |
class Logger | |
include Util::StringFormatter | |
def log(msg) | |
puts prettry_string(msg) | |
end | |
end | |
#---------------------------------------------------------------------- | |
def main | |
puts Util::StringFormatter.prettry_string('from module') | |
Logger.new.log('from class') | |
end | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment