Skip to content

Instantly share code, notes, and snippets.

@barn
Created April 22, 2013 23: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 barn/5439379 to your computer and use it in GitHub Desktop.
Save barn/5439379 to your computer and use it in GitHub Desktop.
Why this happen?
#!/usr/bin/env ruby
require 'ap'
class Updates
attr_reader :parsed, :raw
def initialize( )
unless Updates.has_output?
Updates::get_output
puts 'pop'
ap @parsed
end
@parsed
end
def self.has_output?
return ! @parsed.nil?
end
def self.get_output
@parsed = 'cake'
end
end
foo = Updates.new
ap foo
[kali:~]% ruby foo.rb
pop
nil
#<Updates:0x007fd911039188>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment