Module: Kalimba::Persistence::ClassMethods

Defined in:
lib/kalimba/persistence.rb

Instance Method Summary collapse

Instance Method Details

#all(options = {}) ⇒ Object



79
80
81
# File 'lib/kalimba/persistence.rb', line 79

def all(options = {})
  find(:all, options)
end

#count(attributes = {}) ⇒ Object

Raises:

  • (NotImplementedError)


83
84
85
# File 'lib/kalimba/persistence.rb', line 83

def count(attributes = {})
  raise NotImplementedError
end

#create(attributes = {}) ⇒ Resource?

Create a new instance of RDFS class

Parameters:

  • attributes (Hash<Symbol, String> => Any) (defaults to: {})

Returns:

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/kalimba/persistence.rb', line 37

def create(attributes = {})
  raise NotImplementedError
end

#destroy_allBoolean

Remove all instances of the RDFSClass from the repository

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


52
53
54
# File 'lib/kalimba/persistence.rb', line 52

def destroy_all
  raise NotImplementedError
end

#exist?(attributes = {}) ⇒ Boolean

Check whether instances of the RDFS class exist in the repository

Parameters:

  • attributes (Hash<[Symbol, String] => Any>) (defaults to: {})

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


45
46
47
# File 'lib/kalimba/persistence.rb', line 45

def exist?(attributes = {})
  raise NotImplementedError
end

#find(scope, options = {}) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/kalimba/persistence.rb', line 56

def find(scope, options = {})
  case scope
  when :first
    find_each(options.merge(:limit => 1)).first
  when :all
    find_each(options).to_a
  else
    find_by_id(scope)
  end
end

#find_by_id(id_value) ⇒ Object

Raises:

  • (NotImplementedError)


67
68
69
# File 'lib/kalimba/persistence.rb', line 67

def find_by_id(id_value)
  raise NotImplementedError
end

#find_each(options = {}) ⇒ Object

Raises:

  • (NotImplementedError)


71
72
73
# File 'lib/kalimba/persistence.rb', line 71

def find_each(options = {})
  raise NotImplementedError
end

#first(options = {}) ⇒ Object



75
76
77
# File 'lib/kalimba/persistence.rb', line 75

def first(options = {})
  find(:first, options)
end

#loggerObject



87
88
89
# File 'lib/kalimba/persistence.rb', line 87

def logger
  Kalimba::Persistence.logger
end