Class: CouchIO

Inherits:
Object
  • Object
show all
Defined in:
lib/couchio/couch_io.rb

Direct Known Subclasses

CouchDatabase, CouchDocument

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, mode = 'r', &block) ⇒ CouchIO

Returns a new instance of CouchIO.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/couchio/couch_io.rb', line 7

def initialize(name, mode = 'r', &block)
  @path      = name
  @readable  = mode.include?('r')
  @writeable = mode.include?('w')
  @append    = mode.include?('a')
  
  if block_given?
    yield(self) 
    close
  end
end

Instance Attribute Details

#appendObject

Returns the value of attribute append.



5
6
7
# File 'lib/couchio/couch_io.rb', line 5

def append
  @append
end

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/couchio/couch_io.rb', line 5

def path
  @path
end

#readableObject

Returns the value of attribute readable.



5
6
7
# File 'lib/couchio/couch_io.rb', line 5

def readable
  @readable
end

#writeableObject

Returns the value of attribute writeable.



5
6
7
# File 'lib/couchio/couch_io.rb', line 5

def writeable
  @writeable
end

Instance Method Details

#closeObject



19
# File 'lib/couchio/couch_io.rb', line 19

def close; end

#readObject



21
22
23
# File 'lib/couchio/couch_io.rb', line 21

def read
  read_json
end