Class: DataMetaXtra::FileSys::PosixOwn

Inherits:
Object
  • Object
show all
Defined in:
lib/dataMetaXtra/fileSys.rb

Overview

POSIX ownership information - group and the user

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, group = nil) ⇒ PosixOwn

Convenience constructor

Parameters:



328
329
330
331
# File 'lib/dataMetaXtra/fileSys.rb', line 328

def initialize(user, group = nil)
    @u = PosixOwn.from(user, 'user')
    @g = PosixOwn.from(group, 'group')
end

Instance Attribute Details

#gObject

Returns the value of attribute g.



305
306
307
# File 'lib/dataMetaXtra/fileSys.rb', line 305

def g
  @g
end

#uObject

Returns the value of attribute u.



305
306
307
# File 'lib/dataMetaXtra/fileSys.rb', line 305

def u
  @u
end

Class Method Details

.from(source, kind) ⇒ IdName

Returns instance according to the description.

Parameters:

  • source (String)

    either a String or a IdName or nil, see the method IdName.forName for details.

  • kind (String)

    the kind of the ownership for diagnostics, user or group

Returns:

  • (IdName)

    instance according to the description

Raises:

  • (ArgumentError)

    if the specs contain invalid character in case of a String or if the source is neither a String nor a DataMetaXtra::FileSys::Perm nor nil



314
315
316
317
318
319
320
321
322
323
# File 'lib/dataMetaXtra/fileSys.rb', line 314

def self.from(source, kind)
    case
        when source.kind_of?(NilClass) || source.kind_of?(IdName)
            source
        when source.kind_of?(String)
            IdName.forName(source)
        else
            raise ArgumentError, %<For #{kind} ownership, invalid ownership source: #{source.inspect} >
    end
end