Method: Aliyun::OSS::OSSObject#value

Defined in:
lib/aliyun/oss/object.rb

#value(options = {}, &block) ⇒ Object

Lazily loads object data.

Force a reload of the data by passing :reload.

object.value(:reload)

When loading the data for the first time you can optionally yield to a block which will allow you to stream the data in segments.

object.value do |segment|
  send_data segment
end

The full list of options are listed in the documentation for its class method counter part, OSSObject::value.



481
482
483
484
485
486
487
488
489
490
491
# File 'lib/aliyun/oss/object.rb', line 481

def value(options = {}, &block)
  if options.is_a?(Hash)
    reload = !options.empty?
  else
    reload  = options
    options = {}
  end
  expirable_memoize(reload) do
    self.class.stream(key, bucket.name, options, &block)
  end
end