Module: Moped::GridFS::AccessModes

Included in:
File
Defined in:
lib/moped/gridfs/access_modes.rb

Constant Summary collapse

ACCESS_MODES =
%w[r r+ w w+ a a+]

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#modeObject (readonly)

Returns the value of attribute mode.



5
6
7
# File 'lib/moped/gridfs/access_modes.rb', line 5

def mode
  @mode
end

Instance Method Details

#append?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/moped/gridfs/access_modes.rb', line 17

def append?
  mode =~ /a/
end

#read_only?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/moped/gridfs/access_modes.rb', line 21

def read_only?
  mode == 'r'
end

#read_write?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/moped/gridfs/access_modes.rb', line 29

def read_write?
  mode =~ /\+/
end

#readable?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/moped/gridfs/access_modes.rb', line 9

def readable?
  mode =~ /r|\+/
end

#writable?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/moped/gridfs/access_modes.rb', line 13

def writable?
  mode =~ /w|\+|a/
end

#write_only?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/moped/gridfs/access_modes.rb', line 25

def write_only?
  mode == 'w' or mode == 'a'
end