Skip to content

Instantly share code, notes, and snippets.

@atmos
Created March 15, 2009 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save atmos/79295 to your computer and use it in GitHub Desktop.
Save atmos/79295 to your computer and use it in GitHub Desktop.
require 'rubygems'
gem 'xml-mapping'
require 'xml/mapping'
class Foo
include XML::Mapping
def self.file_data
@file_data ||= nil
end
def self.file_data=(value)
@file_data = value
end
def initialize(file)
if self.class.file_data.nil?
puts "LOADING!!!"
self.class.file_data = self.class.load_from_file(file)
end
end
end
Foo.new("/Users/atmos/.samurai/git/xc88/cluster.xml")
Foo.new("/Users/atmos/.samurai/git/xc88/cluster.xml")
Foo.new("/Users/atmos/.samurai/git/xc88/cluster.xml")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment