Class: LibACL::Permset

Inherits:
NiceFFI::OpaqueStruct
  • Object
show all
Defined in:
lib/libacl.rb

Constant Summary collapse

@@perm_t =
LibACL::find_type(:acl_perm)

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



263
264
265
# File 'lib/libacl.rb', line 263

def == (other)
  to_i == other.to_i
end

#add(perm) ⇒ Object



246
247
248
# File 'lib/libacl.rb', line 246

def add(perm)
  LibACL::acl_add_perm(self,@@perm_t[perm])
end

#clearObject



242
243
244
# File 'lib/libacl.rb', line 242

def clear
  LibACL::acl_clear_perms(self)
end

#delete(perm) ⇒ Object



250
251
252
# File 'lib/libacl.rb', line 250

def delete(perm)
  LibACL::acl_delete_perm(self,@@perm_t[perm])
end

#execute?Boolean

Returns:

  • (Boolean)


276
277
278
# File 'lib/libacl.rb', line 276

def execute?
  is_set? :execute
end

#is_set?(perm) ⇒ Boolean

Returns:

  • (Boolean)


254
255
256
# File 'lib/libacl.rb', line 254

def is_set?(perm)
  LibACL::acl_get_perm(self, @@perm_t[perm]) >0
end

#read?Boolean

Returns:

  • (Boolean)


268
269
270
# File 'lib/libacl.rb', line 268

def read?
  is_set? :read
end

#to_iObject

a linux hack/shortcut



259
260
261
# File 'lib/libacl.rb', line 259

def to_i
  pointer.read_int
end

#to_sObject



280
281
282
283
284
285
286
# File 'lib/libacl.rb', line 280

def to_s
  ret=""
  read? ? ret << "r" : ret << "-"
  write? ? ret << "w" : ret << "-"
  execute? ? ret << "x" : ret << "-"
  ret
end

#write?Boolean

Returns:

  • (Boolean)


272
273
274
# File 'lib/libacl.rb', line 272

def write?
  is_set? :write
end