Skip to content

Instantly share code, notes, and snippets.

@jsn
Last active February 9, 2018 00:02
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 jsn/7141dfb19be7d21da17bbc7614ae0b88 to your computer and use it in GitHub Desktop.
Save jsn/7141dfb19be7d21da17bbc7614ae0b88 to your computer and use it in GitHub Desktop.
jason@jsn cr $ head -n 1000 z.cr z2.cr
==> z.cr <==
class Z
def self.f
puts "in class method"
return Time.now
end
@@x : Time = f()
def self.x
@@x
end
puts "in class"
end
puts "out of class"
==> z2.cr <==
puts Z.x()
puts "before"
require "./z"
puts "after"
jason@jsn cr $ crystal z2.cr
in class method
2018-02-09 03:02:18 +03:00
before
in class
out of class
after
jason@jsn cr $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment