Class: OpenDAL::Metadata

Inherits:
Object
  • Object
show all
Defined in:
src/metadata.rs,
lib/opendal_ruby/metadata.rb

Overview

Metadata about the file.

Constant Summary collapse

FILE =
"File"
DIRECTORY =
"Directory"

Instance Method Summary collapse

Instance Method Details

#content_dispositionString?

Content-Disposition of this object

Returns:

  • (String, nil)


62
63
64
# File 'src/metadata.rs', line 62

pub fn content_disposition(&self) -> Option<&str> {
    self.0.content_disposition()
}

#content_lengthInteger

Content length of this entry.

Returns:

  • (Integer)


70
71
72
# File 'src/metadata.rs', line 70

pub fn content_length(&self) -> u64 {
    self.0.content_length()
}

#content_md5String?

Content MD5 of this entry.

Returns:

  • (String, nil)


78
79
80
# File 'src/metadata.rs', line 78

pub fn content_md5(&self) -> Option<&str> {
    self.0.content_md5()
}

#content_typeString?

Content Type of this entry.

Returns:

  • (String, nil)


86
87
88
# File 'src/metadata.rs', line 86

pub fn content_type(&self) -> Option<&str> {
    self.0.content_type()
}

#dir?Boolean

Returns True if this is a directory.

Returns:

  • (Boolean)


33
34
35
# File 'lib/opendal_ruby/metadata.rb', line 33

def dir?
  mode == DIRECTORY
end

#etagString?

ETag of this entry.

Returns:

  • (String, nil)


94
95
96
97
# File 'src/metadata.rs', line 94

pub fn etag(&self) -> Option<&str> {
        self.0.etag()
    }
}

#file?Boolean

Returns True if this is a file.

Returns:

  • (Boolean)


27
28
29
# File 'lib/opendal_ruby/metadata.rb', line 27

def file?
  mode == FILE
end

#inspectObject



37
38
39
40
41
42
# File 'lib/opendal_ruby/metadata.rb', line 37

def inspect
  # Be concise to keep a few attributes
  "#<#{self.class.name} mode: #{entry_mode}, \
    content_type: #{content_type}, \
    content_length: #{content_length}>"
end

#modeString

The entry mode of this Metadata.

Returns:

  • (String)

    one of File, Directory, Unknown. Unknown means OpenDAL doesn't have actions to the entry.



50
51
52
53
54
55
56
# File 'src/metadata.rs', line 50

pub fn mode(&self) -> &str {
    match self.0.mode() {
        ocore::EntryMode::FILE => "File",
        ocore::EntryMode::DIR => "Directory",
        ocore::EntryMode::Unknown => "Unknown",
    }
}