Skip to content

Instantly share code, notes, and snippets.

@pmint93
Created December 5, 2014 00:46
Show Gist options
  • Save pmint93/789bf09a8c03c92f1215 to your computer and use it in GitHub Desktop.
Save pmint93/789bf09a8c03c92f1215 to your computer and use it in GitHub Desktop.
# Author: pmint93
# Exercise: https://www.facebook.com/groups/718037468264021/permalink/765003373567430/
class Greeter
def self.hello(file = '')
yield if defined? yield
eval open(file).read if File.exist? file
end
end
@pmint93
Copy link
Author

pmint93 commented Dec 5, 2014

I got it 😄 Thanks you very much 👍

@thachck
Copy link

thachck commented Dec 5, 2014

Some minor changes you may have a look 😄

class Greeter
  def self.hello(file = '')
    yield if block_given?
    eval File.read(file)
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment