Class: LibStorj::Ext::Storj::Bucket

Inherits:
FFI::Struct
  • Object
show all
Extended by:
FFI::Library
Defined in:
lib/ruby-libstorj/ext/types.rb,
lib/ruby-libstorj/ext/bucket.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Bucket

Returns a new instance of Bucket.



10
11
12
13
14
15
# File 'lib/ruby-libstorj/ext/bucket.rb', line 10

def initialize(*args)
  super(*args)

  @name = self[:name]
  @id = self[:id]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/ruby-libstorj/ext/bucket.rb', line 8

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/ruby-libstorj/ext/bucket.rb', line 8

def name
  @name
end

Class Method Details

.all(*args) ⇒ Object



17
18
19
# File 'lib/ruby-libstorj/ext/bucket.rb', line 17

def self.all(*args)
  _all(*args)
end

.create(*args) ⇒ Object



21
22
23
# File 'lib/ruby-libstorj/ext/bucket.rb', line 21

def self.create(*args)
  _create(*args)
end

.delete(*args) ⇒ Object



25
26
27
# File 'lib/ruby-libstorj/ext/bucket.rb', line 25

def self.delete(*args)
  _delete(*args)
end

.pointer_to_array(pointer, array_length) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/ruby-libstorj/ext/bucket.rb', line 29

def self.pointer_to_array(pointer, array_length)
  if pointer.nil? || pointer == FFI::MemoryPointer::NULL || array_length < 1
    return nil
  end

  ### #=> [#<LibStorj::Ext::Storj::Bucket ...>, ...]
  (0..(array_length - 1)).map do |i|
    Bucket.new pointer[i * size]
  end
end