Skip to content

Instantly share code, notes, and snippets.

@jsn
Created February 9, 2018 00:17
Show Gist options
  • Save jsn/65cb151969783eaea19bae2453cf2173 to your computer and use it in GitHub Desktop.
Save jsn/65cb151969783eaea19bae2453cf2173 to your computer and use it in GitHub Desktop.
jason@jsn cr $ crystal z2.cr
in class method for x
2018-02-09 03:17:03 +03:00
before
in class method for y
in class
out of class
after
jason@jsn cr $ head -n 1000 z.cr z2.cr
==> z.cr <==
class Z
def self.f(k)
puts "in class method for #{k}"
return Time.now
end
@@x : Time = f(:x)
@@y : Time = f(:y)
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 for x
2018-02-09 03:17:19 +03:00
before
in class method for y
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