Skip to content

Instantly share code, notes, and snippets.

@matsumonkie
Created June 10, 2014 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matsumonkie/265221039784e855ef14 to your computer and use it in GitHub Desktop.
Save matsumonkie/265221039784e855ef14 to your computer and use it in GitHub Desktop.
module functions
#----------------------------------------------------------------------
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