Class: Blobsterix::BlobAccess

Inherits:
Object
  • Object
show all
Defined in:
lib/blobsterix/helper/blob_access.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(atts = {}) ⇒ BlobAccess

Returns a new instance of BlobAccess.



6
7
8
9
10
# File 'lib/blobsterix/helper/blob_access.rb', line 6

def initialize(atts={})
  @trafo = []
  atts.each do |key,value| send("#{key}=",value) end
  identifier
end

Instance Attribute Details

#accept_typeObject

Returns the value of attribute accept_type.



3
4
5
# File 'lib/blobsterix/helper/blob_access.rb', line 3

def accept_type
  @accept_type
end

#bucketObject

Returns the value of attribute bucket.



3
4
5
# File 'lib/blobsterix/helper/blob_access.rb', line 3

def bucket
  @bucket
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/blobsterix/helper/blob_access.rb', line 3

def id
  @id
end

#sourceObject

Returns the value of attribute source.



4
5
6
# File 'lib/blobsterix/helper/blob_access.rb', line 4

def source
  @source
end

#targetObject

Returns the value of attribute target.



4
5
6
# File 'lib/blobsterix/helper/blob_access.rb', line 4

def target
  @target
end

#trafoObject

Returns the value of attribute trafo.



3
4
5
# File 'lib/blobsterix/helper/blob_access.rb', line 3

def trafo
  @trafo
end

Instance Method Details

#copyObject



28
29
30
# File 'lib/blobsterix/helper/blob_access.rb', line 28

def copy
  BlobAccess.new(:bucket => bucket, :id => id, :trafo => trafo, :accept_type => accept_type, :source => source, :target => target)
end

#equals?(blob_access) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/blobsterix/helper/blob_access.rb', line 24

def equals?(blob_access)
  identifier == blob_access.identifier
end

#getObject



20
21
22
# File 'lib/blobsterix/helper/blob_access.rb', line 20

def get
  @meta||=find_blob
end

#identifierObject



12
13
14
# File 'lib/blobsterix/helper/blob_access.rb', line 12

def identifier
   @identifier||= "#{bucket}_#{id.gsub("/","_")}_#{trafo.map {|trafo_pair|"#{trafo_pair[0]}_#{trafo_pair[1]}"}.join(",")}.#{subtype}"
end

#reset!Object



32
33
34
35
# File 'lib/blobsterix/helper/blob_access.rb', line 32

def reset!
  @meta = nil
  self
end

#to_sObject



16
17
18
# File 'lib/blobsterix/helper/blob_access.rb', line 16

def to_s
  "BlobAccess: bucket(#{bucket}), id(#{id}), trafo(#{trafo}), accept_type(#{accept_type})"
end