lib/dm-s3.rb in rpbertp13-dm-s3-0.1.2 vs lib/dm-s3.rb in rpbertp13-dm-s3-0.1.4
- old
+ new
@@ -83,26 +83,33 @@
end
module ClassMethods
#Auto-add the properties in future version
- attr_reader :connector
-
def has_s3_file_at(bucket_name)
- @connector = ClassBucketConnector.new(self, bucket_name)
- class << self
+ @connector = ClassBucketConnector.new(self, bucket_name)
+
+ class << self
+ attr_reader :connector
+ puts self
send :define_method, :s3 do
self.connector.s3
end
+
send :define_method, :bucket do
self.connector.bucket
- end
- end
+ end
+ end
+
+ send :after_class_method, :inherited do |retval, subclass|
+ subclass.instance_variable_set "@connector", @connector
+ end
end
def has_s3_file
@connector = InstanceBucketConnector.new
- end
+ end
+
end
end
Resource.append_inclusions(S3::InstanceMethods)
Model.append_extensions(S3::ClassMethods)
end
\ No newline at end of file