lib/s33r/bucket.rb in s33r-0.5.1 vs lib/s33r/bucket.rb in s33r-0.5.2
- old
+ new
@@ -1,13 +1,9 @@
-base = File.dirname(__FILE__)
-require File.join(base, 'utility')
-
# These methods are added to any Client with a bucket
# binding set.
module S33r
class Bucket < Client
-
attr_accessor :name
# +options+:
# * <tt>:check => true</tt>: if setting a :bucket option, the default behaviour is not to check
# whether the bucket actually exists on S3. If you pass this option,
@@ -15,9 +11,11 @@
# if it isn't, an error is raised (NoSuchBucket).
# * <tt>:create => true</tt>: if the bucket doesn't exist, try to create it.
# S33r will check before trying to create the bucket and will just return the
# bucket if it does.
def initialize(bucket_name, options={})
+ bucket_name_valid?(bucket_name)
+
super(options)
if options[:create]
options[:bucket] = bucket_name
raise last_response.s3_error unless do_put(nil, options).ok?
\ No newline at end of file